home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / lang / Python16_Src.lha / Python16_Source / Modules / clmodule.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-08-03  |  65.4 KB  |  2,568 lines

  1.  
  2. /* Cl objects */
  3.  
  4. #define CLDEBUG
  5.  
  6. #include <stdarg.h>
  7. #include <cl.h>
  8. #if defined(CL_JPEG_SOFTWARE) && !defined(CL_JPEG_COSMO)
  9. #include <dmedia/cl_cosmo.h>
  10. #endif
  11. #include "Python.h"
  12.  
  13. typedef struct {
  14.     PyObject_HEAD
  15.     int ob_isCompressor;    /* Compressor or Decompressor */
  16.     CL_Handle ob_compressorHdl;
  17.     int *ob_paramtypes;
  18.     int ob_nparams;
  19. } clobject;
  20.  
  21. static PyObject *ClError;        /* exception cl.error */
  22.  
  23. static int error_handler_called = 0;
  24.  
  25. /*
  26.  * We want to use the function prototypes that are available in the C
  27.  * compiler on the SGI.  Because of that, we need to declare the first
  28.  * argument of the compressor and decompressor methods as "object *",
  29.  * even though they are really "clobject *".  Therefore we cast the
  30.  * argument to the proper type using this macro.
  31.  */
  32. #define SELF    ((clobject *) self)
  33.  
  34. /********************************************************************
  35.               Utility routines.
  36. ********************************************************************/
  37. static void
  38. cl_ErrorHandler(CL_Handle handle, int code, const char *fmt, ...)
  39. {
  40.     va_list ap;
  41.     char errbuf[BUFSIZ];    /* hopefully big enough */
  42.     char *p;
  43.  
  44.     if (PyErr_Occurred())    /* don't change existing error */
  45.         return;
  46.     error_handler_called = 1;
  47.     va_start(ap, fmt);
  48.     vsprintf(errbuf, fmt, ap);
  49.     va_end(ap);
  50.     p = &errbuf[strlen(errbuf) - 1]; /* swat the line feed */
  51.     if (*p == '\n')
  52.         *p = 0;
  53.     PyErr_SetString(ClError, errbuf);
  54. }
  55.  
  56. /*
  57.  * This assumes that params are always in the range 0 to some maximum.
  58.  */
  59. static int
  60. param_type_is_float(clobject *self, int param)
  61. {
  62.     int bufferlength;
  63.  
  64.     if (self->ob_paramtypes == NULL) {
  65.         error_handler_called = 0;
  66.         bufferlength = clQueryParams(self->ob_compressorHdl, 0, 0);
  67.         if (error_handler_called)
  68.             return -1;
  69.  
  70.         self->ob_paramtypes = PyMem_NEW(int, bufferlength);
  71.         if (self->ob_paramtypes == NULL)
  72.             return -1;
  73.         self->ob_nparams = bufferlength / 2;
  74.  
  75.         (void) clQueryParams(self->ob_compressorHdl,
  76.                      self->ob_paramtypes, bufferlength);
  77.         if (error_handler_called) {
  78.             PyMem_DEL(self->ob_paramtypes);
  79.             self->ob_paramtypes = NULL;
  80.             return -1;
  81.         }
  82.     }
  83.  
  84.     if (param < 0 || param >= self->ob_nparams)
  85.         return -1;
  86.  
  87.     if (self->ob_paramtypes[param*2 + 1] == CL_FLOATING_ENUM_VALUE ||
  88.         self->ob_paramtypes[param*2 + 1] == CL_FLOATING_RANGE_VALUE)
  89.         return 1;
  90.     else
  91.         return 0;
  92. }
  93.  
  94. /********************************************************************
  95.            Single image compression/decompression.
  96. ********************************************************************/
  97. static PyObject *
  98. cl_CompressImage(PyObject *self, PyObject *args)
  99. {
  100.     int compressionScheme, width, height, originalFormat;
  101.     float compressionRatio;
  102.     int frameBufferSize, compressedBufferSize;
  103.     char *frameBuffer;
  104.     PyObject *compressedBuffer;
  105.  
  106.     if (!PyArg_Parse(args, "(iiiifs#)", &compressionScheme,
  107.              &width, &height,
  108.              &originalFormat, &compressionRatio, &frameBuffer,
  109.              &frameBufferSize))
  110.         return NULL;
  111.  
  112.   retry:
  113.     compressedBuffer = PyString_FromStringAndSize(NULL, frameBufferSize);
  114.     if (compressedBuffer == NULL)
  115.         return NULL;
  116.  
  117.     compressedBufferSize = frameBufferSize;
  118.     error_handler_called = 0;
  119.     if (clCompressImage(compressionScheme, width, height, originalFormat,
  120.                 compressionRatio, (void *) frameBuffer,
  121.                 &compressedBufferSize,
  122.                 (void *) PyString_AsString(compressedBuffer))
  123.         == FAILURE || error_handler_called) {
  124.         Py_DECREF(compressedBuffer);
  125.         if (!error_handler_called)
  126.             PyErr_SetString(ClError, "clCompressImage failed");
  127.         return NULL;
  128.     }
  129.  
  130.     if (compressedBufferSize > frameBufferSize) {
  131.         frameBufferSize = compressedBufferSize;
  132.         Py_DECREF(compressedBuffer);
  133.         goto retry;
  134.     }
  135.  
  136.     if (compressedBufferSize < frameBufferSize)
  137.         if (_PyString_Resize(&compressedBuffer, compressedBufferSize))
  138.             return NULL;
  139.  
  140.     return compressedBuffer;
  141. }
  142.  
  143. static PyObject *
  144. cl_DecompressImage(PyObject *self, PyObject *args)
  145. {
  146.     int compressionScheme, width, height, originalFormat;
  147.     char *compressedBuffer;
  148.     int compressedBufferSize, frameBufferSize;
  149.     PyObject *frameBuffer;
  150.  
  151.     if (!PyArg_Parse(args, "(iiiis#)", &compressionScheme, &width, &height,
  152.              &originalFormat, &compressedBuffer,
  153.              &compressedBufferSize))
  154.         return NULL;
  155.  
  156.     frameBufferSize = width * height * CL_BytesPerPixel(originalFormat);
  157.  
  158.     frameBuffer = PyString_FromStringAndSize(NULL, frameBufferSize);
  159.     if (frameBuffer == NULL)
  160.         return NULL;
  161.  
  162.     error_handler_called = 0;
  163.     if (clDecompressImage(compressionScheme, width, height, originalFormat,
  164.                   compressedBufferSize, compressedBuffer,
  165.                   (void *) PyString_AsString(frameBuffer))
  166.         == FAILURE || error_handler_called) {
  167.         Py_DECREF(frameBuffer);
  168.         if (!error_handler_called)
  169.             PyErr_SetString(ClError, "clDecompressImage failed");
  170.         return NULL;
  171.     }
  172.  
  173.     return frameBuffer;
  174. }
  175.  
  176. /********************************************************************
  177.         Sequential compression/decompression.
  178. ********************************************************************/
  179. #define CheckCompressor(self)    if ((self)->ob_compressorHdl == NULL) { \
  180.     PyErr_SetString(PyExc_RuntimeError, "(de)compressor not active"); \
  181.     return NULL; \
  182. }
  183.  
  184. static PyObject *
  185. doClose(clobject *self, PyObject *args, int (*close_func)(CL_Handle))
  186. {
  187.     CheckCompressor(self);
  188.  
  189.     if (!PyArg_NoArgs(args))
  190.         return NULL;
  191.  
  192.     error_handler_called = 0;
  193.     if ((*close_func)(self->ob_compressorHdl) == FAILURE ||
  194.         error_handler_called) {
  195.         if (!error_handler_called)
  196.             PyErr_SetString(ClError, "close failed");
  197.         return NULL;
  198.     }
  199.  
  200.     self->ob_compressorHdl = NULL;
  201.  
  202.     if (self->ob_paramtypes)
  203.         PyMem_DEL(self->ob_paramtypes);
  204.     self->ob_paramtypes = NULL;
  205.  
  206.     Py_INCREF(Py_None);
  207.     return Py_None;
  208. }
  209.  
  210. static PyObject *
  211. clm_CloseCompressor(PyObject *self, PyObject *args)
  212. {
  213.     return doClose(SELF, args, clCloseCompressor);
  214. }
  215.  
  216. static PyObject *
  217. clm_CloseDecompressor(PyObject *self, PyObject *args)
  218. {
  219.     return doClose(SELF, args, clCloseDecompressor);
  220. }
  221.  
  222. static PyObject *
  223. clm_Compress(PyObject *self, PyObject *args)
  224. {
  225.     int numberOfFrames;
  226.     int frameBufferSize, compressedBufferSize, size;
  227.     char *frameBuffer;
  228.     PyObject *data;
  229.  
  230.     CheckCompressor(SELF);
  231.  
  232.     if (!PyArg_Parse(args, "(is#)", &numberOfFrames,
  233.              &frameBuffer, &frameBufferSize))
  234.         return NULL;
  235.  
  236.     error_handler_called = 0;
  237.     size = clGetParam(SELF->ob_compressorHdl, CL_COMPRESSED_BUFFER_SIZE);
  238.     compressedBufferSize = size;
  239.     if (error_handler_called)
  240.         return NULL;
  241.  
  242.     data = PyString_FromStringAndSize(NULL, size);
  243.     if (data == NULL)
  244.         return NULL;
  245.  
  246.     error_handler_called = 0;
  247.     if (clCompress(SELF->ob_compressorHdl, numberOfFrames,
  248.                (void *) frameBuffer, &compressedBufferSize,
  249.                (void *) PyString_AsString(data)) == FAILURE ||
  250.         error_handler_called) {
  251.         Py_DECREF(data);
  252.         if (!error_handler_called)
  253.             PyErr_SetString(ClError, "compress failed");
  254.         return NULL;
  255.     }
  256.  
  257.     if (compressedBufferSize < size)
  258.         if (_PyString_Resize(&data, compressedBufferSize))
  259.             return NULL;
  260.  
  261.     if (compressedBufferSize > size) {
  262.         /* we didn't get all "compressed" data */
  263.         Py_DECREF(data);
  264.         PyErr_SetString(ClError,
  265.                 "compressed data is more than fitted");
  266.         return NULL;
  267.     }
  268.  
  269.     return data;
  270. }
  271.  
  272. static PyObject *
  273. clm_Decompress(PyObject *self, PyObject *args)
  274. {
  275.     PyObject *data;
  276.     int numberOfFrames;
  277.     char *compressedData;
  278.     int compressedDataSize, dataSize;
  279.  
  280.     CheckCompressor(SELF);
  281.  
  282.     if (!PyArg_Parse(args, "(is#)", &numberOfFrames, &compressedData,
  283.              &compressedDataSize))
  284.         return NULL;
  285.  
  286.     error_handler_called = 0;
  287.     dataSize = clGetParam(SELF->ob_compressorHdl, CL_FRAME_BUFFER_SIZE);
  288.     if (error_handler_called)
  289.         return NULL;
  290.  
  291.     data = PyString_FromStringAndSize(NULL, dataSize);
  292.     if (data == NULL)
  293.         return NULL;
  294.  
  295.     error_handler_called = 0;
  296.     if (clDecompress(SELF->ob_compressorHdl, numberOfFrames,
  297.              compressedDataSize, (void *) compressedData,
  298.              (void *) PyString_AsString(data)) == FAILURE ||
  299.         error_handler_called) {
  300.         Py_DECREF(data);
  301.         if (!error_handler_called)
  302.             PyErr_SetString(ClError, "decompress failed");
  303.         return NULL;
  304.     }
  305.  
  306.     return data;
  307. }
  308.  
  309. static PyObject *
  310. doParams(clobject *self, PyObject *args, int (*func)(CL_Handle, int *, int),
  311.      int modified)
  312. {
  313.     PyObject *list, *v;
  314.     int *PVbuffer;
  315.     int length;
  316.     int i;
  317.     float number;
  318.     
  319.     CheckCompressor(self);
  320.  
  321.     if (!PyArg_Parse(args, "O", &list))
  322.         return NULL;
  323.     if (!PyList_Check(list)) {
  324.         PyErr_BadArgument();
  325.         return NULL;
  326.     }
  327.     length = PyList_Size(list);
  328.     PVbuffer = PyMem_NEW(int, length);
  329.     if (PVbuffer == NULL)
  330.         return PyErr_NoMemory();
  331.     for (i = 0; i < length; i++) {
  332.         v = PyList_GetItem(list, i);
  333.         if (PyFloat_Check(v)) {
  334.             number = PyFloat_AsDouble(v);
  335.             PVbuffer[i] = CL_TypeIsInt(number);
  336.         } else if (PyInt_Check(v)) {
  337.             PVbuffer[i] = PyInt_AsLong(v);
  338.             if ((i & 1) &&
  339.                 param_type_is_float(self, PVbuffer[i-1]) > 0) {
  340.                 number = PVbuffer[i];
  341.                 PVbuffer[i] = CL_TypeIsInt(number);
  342.             }
  343.         } else {
  344.             PyMem_DEL(PVbuffer);
  345.             PyErr_BadArgument();
  346.             return NULL;
  347.         }
  348.     }
  349.  
  350.     error_handler_called = 0;
  351.     (*func)(self->ob_compressorHdl, PVbuffer, length);
  352.     if (error_handler_called) {
  353.         PyMem_DEL(PVbuffer);
  354.         return NULL;
  355.     }
  356.  
  357.     if (modified) {
  358.         for (i = 0; i < length; i++) {
  359.             if ((i & 1) &&
  360.                 param_type_is_float(self, PVbuffer[i-1]) > 0) {
  361.                 number = CL_TypeIsFloat(PVbuffer[i]);
  362.                 v = PyFloat_FromDouble(number);
  363.             } else
  364.                 v = PyInt_FromLong(PVbuffer[i]);
  365.             PyList_SetItem(list, i, v);
  366.         }
  367.     }
  368.  
  369.     PyMem_DEL(PVbuffer);
  370.  
  371.     Py_INCREF(Py_None);
  372.     return Py_None;
  373. }
  374.  
  375. static PyObject *
  376. clm_GetParams(PyObject *self, PyObject *args)
  377. {
  378.     return doParams(SELF, args, clGetParams, 1);
  379. }
  380.  
  381. static PyObject *
  382. clm_SetParams(PyObject *self, PyObject *args)
  383. {
  384.     return doParams(SELF, args, clSetParams, 0);
  385. }
  386.  
  387. static PyObject *
  388. do_get(clobject *self, PyObject *args, int (*func)(CL_Handle, int))
  389. {
  390.     int paramID, value;
  391.     float fvalue;
  392.  
  393.     CheckCompressor(self);
  394.  
  395.     if (!PyArg_Parse(args, "i", ¶mID))
  396.         return NULL;
  397.  
  398.     error_handler_called = 0;
  399.     value = (*func)(self->ob_compressorHdl, paramID);
  400.     if (error_handler_called)
  401.         return NULL;
  402.  
  403.     if (param_type_is_float(self, paramID) > 0) {
  404.         fvalue = CL_TypeIsFloat(value);
  405.         return PyFloat_FromDouble(fvalue);
  406.     }
  407.  
  408.     return PyInt_FromLong(value);
  409. }
  410.  
  411. static PyObject *
  412. clm_GetParam(PyObject *self, PyObject *args)
  413. {
  414.     return do_get(SELF, args, clGetParam);
  415. }
  416.  
  417. static PyObject *
  418. clm_GetDefault(PyObject *self, PyObject *args)
  419. {
  420.     return do_get(SELF, args, clGetDefault);
  421. }
  422.  
  423. static PyObject *
  424. clm_SetParam(PyObject *self, PyObject *args)
  425. {
  426.     int paramID, value;
  427.     float fvalue;
  428.  
  429.     CheckCompressor(SELF);
  430.  
  431.     if (!PyArg_Parse(args, "(ii)", ¶mID, &value)) {
  432.         PyErr_Clear();
  433.         if (!PyArg_Parse(args, "(if)", ¶mID, &fvalue)) {
  434.             PyErr_Clear();
  435.             PyErr_SetString(PyExc_TypeError,
  436.                    "bad argument list (format '(ii)' or '(if)')");
  437.             return NULL;
  438.         }
  439.         value = CL_TypeIsInt(fvalue);
  440.     } else {
  441.         if (param_type_is_float(SELF, paramID) > 0) {
  442.             fvalue = value;
  443.             value = CL_TypeIsInt(fvalue);
  444.         }
  445.     }
  446.  
  447.      error_handler_called = 0;
  448.     value = clSetParam(SELF->ob_compressorHdl, paramID, value);
  449.     if (error_handler_called)
  450.         return NULL;
  451.  
  452.     if (param_type_is_float(SELF, paramID) > 0)
  453.         return PyFloat_FromDouble(CL_TypeIsFloat(value));
  454.     else
  455.         return PyInt_FromLong(value);
  456. }
  457.  
  458. static PyObject *
  459. clm_GetParamID(PyObject *self, PyObject *args)
  460. {
  461.     char *name;
  462.     int value;
  463.  
  464.     CheckCompressor(SELF);
  465.  
  466.     if (!PyArg_Parse(args, "s", &name))
  467.         return NULL;
  468.  
  469.     error_handler_called = 0;
  470.     value = clGetParamID(SELF->ob_compressorHdl, name);
  471.     if (value == FAILURE || error_handler_called) {
  472.         if (!error_handler_called)
  473.             PyErr_SetString(ClError, "getparamid failed");
  474.         return NULL;
  475.     }
  476.  
  477.     return PyInt_FromLong(value);
  478. }
  479.  
  480. static PyObject *
  481. clm_QueryParams(PyObject *self, PyObject *args)
  482. {
  483.     int bufferlength;
  484.     int *PVbuffer;
  485.     PyObject *list;
  486.     int i;
  487.  
  488.     CheckCompressor(SELF);
  489.  
  490.     if (!PyArg_NoArgs(args))
  491.         return NULL;
  492.  
  493.     error_handler_called = 0;
  494.     bufferlength = clQueryParams(SELF->ob_compressorHdl, 0, 0);
  495.     if (error_handler_called)
  496.         return NULL;
  497.  
  498.     PVbuffer = PyMem_NEW(int, bufferlength);
  499.     if (PVbuffer == NULL)
  500.         return PyErr_NoMemory();
  501.  
  502.     bufferlength = clQueryParams(SELF->ob_compressorHdl, PVbuffer,
  503.                      bufferlength);
  504.     if (error_handler_called) {
  505.         PyMem_DEL(PVbuffer);
  506.         return NULL;
  507.     }
  508.  
  509.     list = PyList_New(bufferlength);
  510.     if (list == NULL) {
  511.         PyMem_DEL(PVbuffer);
  512.         return NULL;
  513.     }
  514.  
  515.     for (i = 0; i < bufferlength; i++) {
  516.         if (i & 1)
  517.             PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i]));
  518.         else if (PVbuffer[i] == 0) {
  519.             Py_INCREF(Py_None);
  520.             PyList_SetItem(list, i, Py_None);
  521.         } else
  522.             PyList_SetItem(list, i,
  523.                    PyString_FromString((char *) PVbuffer[i]));
  524.     }
  525.  
  526.     PyMem_DEL(PVbuffer);
  527.  
  528.     return list;
  529. }
  530.  
  531. static PyObject *
  532. clm_GetMinMax(PyObject *self, PyObject *args)
  533. {
  534.     int param, min, max;
  535.     float fmin, fmax;
  536.  
  537.     CheckCompressor(SELF);
  538.  
  539.     if (!PyArg_Parse(args, "i", ¶m))
  540.         return NULL;
  541.  
  542.     clGetMinMax(SELF->ob_compressorHdl, param, &min, &max);
  543.  
  544.     if (param_type_is_float(SELF, param) > 0) {
  545.         fmin = CL_TypeIsFloat(min);
  546.         fmax = CL_TypeIsFloat(max);
  547.         return Py_BuildValue("(ff)", fmin, fmax);
  548.     }
  549.  
  550.     return Py_BuildValue("(ii)", min, max);
  551. }
  552.  
  553. static PyObject *
  554. clm_GetName(PyObject *self, PyObject *args)
  555. {
  556.     int param;
  557.     char *name;
  558.  
  559.     CheckCompressor(SELF);
  560.  
  561.     if (!PyArg_Parse(args, "i", ¶m))
  562.         return NULL;
  563.  
  564.     error_handler_called = 0;
  565.     name = clGetName(SELF->ob_compressorHdl, param);
  566.     if (name == NULL || error_handler_called) {
  567.         if (!error_handler_called)
  568.             PyErr_SetString(ClError, "getname failed");
  569.         return NULL;
  570.     }
  571.  
  572.     return PyString_FromString(name);
  573. }
  574.  
  575. static PyObject *
  576. clm_QuerySchemeFromHandle(PyObject *self, PyObject *args)
  577. {
  578.     CheckCompressor(SELF);
  579.  
  580.     if (!PyArg_NoArgs(args))
  581.         return NULL;
  582.  
  583.     return PyInt_FromLong(clQuerySchemeFromHandle(SELF->ob_compressorHdl));
  584. }
  585.  
  586. static PyObject *
  587. clm_ReadHeader(PyObject *self, PyObject *args)
  588. {
  589.     char *header;
  590.     int headerSize;
  591.  
  592.     CheckCompressor(SELF);
  593.  
  594.     if (!PyArg_Parse(args, "s#", &header, &headerSize))
  595.         return NULL;
  596.  
  597.     return PyInt_FromLong(clReadHeader(SELF->ob_compressorHdl,
  598.                        headerSize, header));
  599. }
  600.  
  601. static PyMethodDef compressor_methods[] = {
  602.     {"close",        clm_CloseCompressor}, /* alias */
  603.     {"CloseCompressor",    clm_CloseCompressor},
  604.     {"Compress",        clm_Compress},
  605.     {"GetDefault",        clm_GetDefault},
  606.     {"GetMinMax",        clm_GetMinMax},
  607.     {"GetName",        clm_GetName},
  608.     {"GetParam",        clm_GetParam},
  609.     {"GetParamID",        clm_GetParamID},
  610.     {"GetParams",        clm_GetParams},
  611.     {"QueryParams",        clm_QueryParams},
  612.     {"QuerySchemeFromHandle",clm_QuerySchemeFromHandle},
  613.     {"SetParam",        clm_SetParam},
  614.     {"SetParams",        clm_SetParams},
  615.     {NULL,            NULL}        /* sentinel */
  616. };
  617.  
  618. static PyMethodDef decompressor_methods[] = {
  619.     {"close",        clm_CloseDecompressor},    /* alias */
  620.     {"CloseDecompressor",    clm_CloseDecompressor},
  621.     {"Decompress",        clm_Decompress},
  622.     {"GetDefault",        clm_GetDefault},
  623.     {"GetMinMax",        clm_GetMinMax},
  624.     {"GetName",        clm_GetName},
  625.     {"GetParam",        clm_GetParam},
  626.     {"GetParamID",        clm_GetParamID},
  627.     {"GetParams",        clm_GetParams},
  628.     {"ReadHeader",        clm_ReadHeader},
  629.     {"QueryParams",        clm_QueryParams},
  630.     {"QuerySchemeFromHandle",clm_QuerySchemeFromHandle},
  631.     {"SetParam",        clm_SetParam},
  632.     {"SetParams",        clm_SetParams},
  633.     {NULL,            NULL}        /* sentinel */
  634. };
  635.  
  636. static void
  637. cl_dealloc(PyObject *self)
  638. {
  639.     if (SELF->ob_compressorHdl) {
  640.         if (SELF->ob_isCompressor)
  641.             clCloseCompressor(SELF->ob_compressorHdl);
  642.         else
  643.             clCloseDecompressor(SELF->ob_compressorHdl);
  644.     }
  645.     PyObject_Del(self);
  646. }
  647.  
  648. static PyObject *
  649. cl_getattr(PyObject *self, char *name)
  650. {
  651.     if (SELF->ob_isCompressor)
  652.         return Py_FindMethod(compressor_methods, self, name);
  653.     else
  654.         return Py_FindMethod(decompressor_methods, self, name);
  655. }
  656.  
  657. static PyTypeObject Cltype = {
  658.     PyObject_HEAD_INIT(&PyType_Type)
  659.     0,            /*ob_size*/
  660.     "cl",            /*tp_name*/
  661.     sizeof(clobject),    /*tp_size*/
  662.     0,            /*tp_itemsize*/
  663.     /* methods */
  664.     (destructor)cl_dealloc,    /*tp_dealloc*/
  665.     0,            /*tp_print*/
  666.     (getattrfunc)cl_getattr, /*tp_getattr*/
  667.     0,            /*tp_setattr*/
  668.     0,            /*tp_compare*/
  669.     0,            /*tp_repr*/
  670.     0,            /*tp_as_number*/
  671.     0,            /*tp_as_sequence*/
  672.     0,            /*tp_as_mapping*/
  673. };
  674.  
  675. static PyObject *
  676. doOpen(PyObject *self, PyObject *args, int (*open_func)(int, CL_Handle *),
  677.        int iscompressor)
  678. {
  679.     int scheme;
  680.     clobject *new;
  681.  
  682.     if (!PyArg_Parse(args, "i", &scheme))
  683.         return NULL;
  684.  
  685.     new = PyObject_New(clobject, &Cltype);
  686.     if (new == NULL)
  687.         return NULL;
  688.  
  689.     new->ob_compressorHdl = NULL;
  690.     new->ob_isCompressor = iscompressor;
  691.     new->ob_paramtypes = NULL;
  692.  
  693.     error_handler_called = 0;
  694.     if ((*open_func)(scheme, &new->ob_compressorHdl) == FAILURE ||
  695.         error_handler_called) {
  696.         Py_DECREF(new);
  697.         if (!error_handler_called)
  698.             PyErr_SetString(ClError, "Open(De)Compressor failed");
  699.         return NULL;
  700.     }
  701.     return (PyObject *)new;
  702. }
  703.  
  704. static PyObject *
  705. cl_OpenCompressor(PyObject *self, PyObject *args)
  706. {
  707.     return doOpen(self, args, clOpenCompressor, 1);
  708. }
  709.  
  710. static PyObject *
  711. cl_OpenDecompressor(PyObject *self, PyObject *args)
  712. {
  713.     return doOpen(self, args, clOpenDecompressor, 0);
  714. }
  715.  
  716. static PyObject *
  717. cl_QueryScheme(PyObject *self, PyObject *args)
  718. {
  719.     char *header;
  720.     int headerlen;
  721.     int scheme;
  722.  
  723.     if (!PyArg_Parse(args, "s#", &header, &headerlen))
  724.         return NULL;
  725.  
  726.     scheme = clQueryScheme(header);
  727.     if (scheme < 0) {
  728.         PyErr_SetString(ClError, "unknown compression scheme");
  729.         return NULL;
  730.     }
  731.  
  732.     return PyInt_FromLong(scheme);
  733. }
  734.  
  735. static PyObject *
  736. cl_QueryMaxHeaderSize(PyObject *self, PyObject *args)
  737. {
  738.     int scheme;
  739.  
  740.     if (!PyArg_Parse(args, "i", &scheme))
  741.         return NULL;
  742.  
  743.     return PyInt_FromLong(clQueryMaxHeaderSize(scheme));
  744. }
  745.  
  746. static PyObject *
  747. cl_QueryAlgorithms(PyObject *self, PyObject *args)
  748. {
  749.     int algorithmMediaType;
  750.     int bufferlength;
  751.     int *PVbuffer;
  752.     PyObject *list;
  753.     int i;
  754.  
  755.     if (!PyArg_Parse(args, "i", &algorithmMediaType))
  756.         return NULL;
  757.  
  758.     error_handler_called = 0;
  759.     bufferlength = clQueryAlgorithms(algorithmMediaType, 0, 0);
  760.     if (error_handler_called)
  761.         return NULL;
  762.  
  763.     PVbuffer = PyMem_NEW(int, bufferlength);
  764.     if (PVbuffer == NULL)
  765.         return PyErr_NoMemory();
  766.  
  767.     bufferlength = clQueryAlgorithms(algorithmMediaType, PVbuffer,
  768.                      bufferlength);
  769.     if (error_handler_called) {
  770.         PyMem_DEL(PVbuffer);
  771.         return NULL;
  772.     }
  773.  
  774.     list = PyList_New(bufferlength);
  775.     if (list == NULL) {
  776.         PyMem_DEL(PVbuffer);
  777.         return NULL;
  778.     }
  779.  
  780.     for (i = 0; i < bufferlength; i++) {
  781.         if (i & 1)
  782.             PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i]));
  783.         else if (PVbuffer[i] == 0) {
  784.             Py_INCREF(Py_None);
  785.             PyList_SetItem(list, i, Py_None);
  786.         } else
  787.             PyList_SetItem(list, i,
  788.                    PyString_FromString((char *) PVbuffer[i]));
  789.     }
  790.  
  791.     PyMem_DEL(PVbuffer);
  792.  
  793.     return list;
  794. }
  795.  
  796. static PyObject *
  797. cl_QuerySchemeFromName(PyObject *self, PyObject *args)
  798. {
  799.     int algorithmMediaType;
  800.     char *name;
  801.     int scheme;
  802.  
  803.     if (!PyArg_Parse(args, "(is)", &algorithmMediaType, &name))
  804.         return NULL;
  805.  
  806.     error_handler_called = 0;
  807.     scheme = clQuerySchemeFromName(algorithmMediaType, name);
  808.     if (error_handler_called) {
  809.         PyErr_SetString(ClError, "unknown compression scheme");
  810.         return NULL;
  811.     }
  812.  
  813.     return PyInt_FromLong(scheme);
  814. }
  815.  
  816. static PyObject *
  817. cl_GetAlgorithmName(PyObject *self, PyObject *args)
  818. {
  819.     int scheme;
  820.     char *name;
  821.  
  822.     if (!PyArg_Parse(args, "i", &scheme))
  823.         return NULL;
  824.  
  825.     name = clGetAlgorithmName(scheme);
  826.     if (name == 0) {
  827.         PyErr_SetString(ClError, "unknown compression scheme");
  828.         return NULL;
  829.     }
  830.  
  831.     return PyString_FromString(name);
  832. }
  833.  
  834. static PyObject *
  835. do_set(PyObject *self, PyObject *args, int (*func)(int, int, int))
  836. {
  837.     int scheme, paramID, value;
  838.     float fvalue;
  839.     int is_float = 0;
  840.  
  841.     if (!PyArg_Parse(args, "(iii)", &scheme, ¶mID, &value)) {
  842.         PyErr_Clear();
  843.         if (!PyArg_Parse(args, "(iif)", &scheme, ¶mID, &fvalue)) {
  844.             PyErr_Clear();
  845.             PyErr_SetString(PyExc_TypeError,
  846.                  "bad argument list (format '(iii)' or '(iif)')");
  847.             return NULL;
  848.         }
  849.         value = CL_TypeIsInt(fvalue);
  850.         is_float = 1;
  851.     } else {
  852.         /* check some parameters which we know to be floats */
  853.         switch (scheme) {
  854.         case CL_COMPRESSION_RATIO:
  855.         case CL_SPEED:
  856.             fvalue = value;
  857.             value = CL_TypeIsInt(fvalue);
  858.             is_float = 1;
  859.             break;
  860.         }
  861.     }
  862.  
  863.      error_handler_called = 0;
  864.     value = (*func)(scheme, paramID, value);
  865.     if (error_handler_called)
  866.         return NULL;
  867.  
  868.     if (is_float)
  869.         return PyFloat_FromDouble(CL_TypeIsFloat(value));
  870.     else
  871.         return PyInt_FromLong(value);
  872. }
  873.  
  874. static PyObject *
  875. cl_SetDefault(PyObject *self, PyObject *args)
  876. {
  877.     return do_set(self, args, clSetDefault);
  878. }
  879.  
  880. static PyObject *
  881. cl_SetMin(PyObject *self, PyObject *args)
  882. {
  883.     return do_set(self, args, clSetMin);
  884. }
  885.  
  886. static PyObject *
  887. cl_SetMax(PyObject *self, PyObject *args)
  888. {
  889.     return do_set(self, args, clSetMax);
  890. }
  891.  
  892. #define func(name, handler)    \
  893. static PyObject *cl_##name(PyObject *self, PyObject *args) \
  894. { \
  895.       int x; \
  896.       if (!PyArg_Parse(args, "i", &x)) return NULL; \
  897.       return Py##handler(CL_##name(x)); \
  898. }
  899.  
  900. #define func2(name, handler)    \
  901. static PyObject *cl_##name(PyObject *self, PyObject *args) \
  902. { \
  903.       int a1, a2; \
  904.       if (!PyArg_Parse(args, "(ii)", &a1, &a2)) return NULL; \
  905.       return Py##handler(CL_##name(a1, a2)); \
  906. }
  907.  
  908. func(BytesPerSample, Int_FromLong)
  909. func(BytesPerPixel, Int_FromLong)
  910. func(AudioFormatName, String_FromString)
  911. func(VideoFormatName, String_FromString)
  912. func(AlgorithmNumber, Int_FromLong)
  913. func(AlgorithmType, Int_FromLong)
  914. func2(Algorithm, Int_FromLong)
  915. func(ParamNumber, Int_FromLong)
  916. func(ParamType, Int_FromLong)
  917. func2(ParamID, Int_FromLong)
  918.  
  919. #ifdef CLDEBUG
  920.     static PyObject *
  921. cvt_type(PyObject *self, PyObject *args)
  922. {
  923.     int number;
  924.     float fnumber;
  925.  
  926.     if (PyArg_Parse(args, "i", &number))
  927.         return PyFloat_FromDouble(CL_TypeIsFloat(number));
  928.     else {
  929.         PyErr_Clear();
  930.         if (PyArg_Parse(args, "f", &fnumber))
  931.             return PyInt_FromLong(CL_TypeIsInt(fnumber));
  932.         return NULL;
  933.     }
  934. }
  935. #endif
  936.  
  937. static PyMethodDef cl_methods[] = {
  938.     {"CompressImage",    cl_CompressImage},
  939.     {"DecompressImage",    cl_DecompressImage},
  940.     {"GetAlgorithmName",    cl_GetAlgorithmName},
  941.     {"OpenCompressor",    cl_OpenCompressor},
  942.     {"OpenDecompressor",    cl_OpenDecompressor},
  943.     {"QueryAlgorithms",    cl_QueryAlgorithms},
  944.     {"QueryMaxHeaderSize",    cl_QueryMaxHeaderSize},
  945.     {"QueryScheme",        cl_QueryScheme},
  946.     {"QuerySchemeFromName",    cl_QuerySchemeFromName},
  947.     {"SetDefault",        cl_SetDefault},
  948.     {"SetMax",        cl_SetMax},
  949.     {"SetMin",        cl_SetMin},
  950.     {"BytesPerSample",    cl_BytesPerSample},
  951.     {"BytesPerPixel",    cl_BytesPerPixel},
  952.     {"AudioFormatName",    cl_AudioFormatName},
  953.     {"VideoFormatName",    cl_VideoFormatName},
  954.     {"AlgorithmNumber",    cl_AlgorithmNumber},
  955.     {"AlgorithmType",    cl_AlgorithmType},
  956.     {"Algorithm",        cl_Algorithm},
  957.     {"ParamNumber",        cl_ParamNumber},
  958.     {"ParamType",        cl_ParamType},
  959.     {"ParamID",        cl_ParamID},
  960. #ifdef CLDEBUG
  961.     {"cvt_type",        cvt_type},
  962. #endif
  963.     {NULL,            NULL} /* Sentinel */
  964. };
  965.  
  966. #ifdef CL_JPEG_SOFTWARE
  967. #define IRIX_5_3_LIBRARY
  968. #endif
  969.  
  970. void
  971. initcl()
  972. {
  973.     PyObject *m, *d, *x;
  974.  
  975.     m = Py_InitModule("cl", cl_methods);
  976.     d = PyModule_GetDict(m);
  977.  
  978.     ClError = PyErr_NewException("cl.error", NULL, NULL);
  979.     (void) PyDict_SetItemString(d, "error", ClError);
  980.  
  981. #ifdef CL_ADDED_ALGORITHM_ERROR
  982.     x = PyInt_FromLong(CL_ADDED_ALGORITHM_ERROR);
  983.     if (x == NULL || PyDict_SetItemString(d, "ADDED_ALGORITHM_ERROR", x) < 0)
  984.         return;
  985.     Py_DECREF(x);
  986. #endif
  987. #ifdef CL_ALAW
  988.     x = PyInt_FromLong(CL_ALAW);
  989.     if (x == NULL || PyDict_SetItemString(d, "ALAW", x) < 0)
  990.         return;
  991.     Py_DECREF(x);
  992. #endif
  993. #ifdef CL_ALGORITHM_ID
  994.     x = PyInt_FromLong(CL_ALGORITHM_ID);
  995.     if (x == NULL || PyDict_SetItemString(d, "ALGORITHM_ID", x) < 0)
  996.         return;
  997.     Py_DECREF(x);
  998. #endif
  999. #ifdef CL_ALGORITHM_TABLE_FULL
  1000.     x = PyInt_FromLong(CL_ALGORITHM_TABLE_FULL);
  1001.     if (x == NULL || PyDict_SetItemString(d, "ALGORITHM_TABLE_FULL", x) < 0)
  1002.         return;
  1003.     Py_DECREF(x);
  1004. #endif
  1005. #ifdef CL_ALGORITHM_VERSION
  1006.     x = PyInt_FromLong(CL_ALGORITHM_VERSION);
  1007.     if (x == NULL || PyDict_SetItemString(d, "ALGORITHM_VERSION", x) < 0)
  1008.         return;
  1009.     Py_DECREF(x);
  1010. #endif
  1011. #ifdef CL_ALG_AUDIO
  1012.     x = PyInt_FromLong(CL_ALG_AUDIO);
  1013.     if (x == NULL || PyDict_SetItemString(d, "ALG_AUDIO", x) < 0)
  1014.         return;
  1015.     Py_DECREF(x);
  1016. #endif
  1017. #ifdef CL_ALG_VIDEO
  1018.     x = PyInt_FromLong(CL_ALG_VIDEO);
  1019.     if (x == NULL || PyDict_SetItemString(d, "ALG_VIDEO", x) < 0)
  1020.         return;
  1021.     Py_DECREF(x);
  1022. #endif
  1023. #ifdef CL_AUDIO
  1024.     x = PyInt_FromLong(CL_AUDIO);
  1025.     if (x == NULL || PyDict_SetItemString(d, "AUDIO", x) < 0)
  1026.         return;
  1027.     Py_DECREF(x);
  1028. #endif
  1029. #ifdef CL_AWARE_BITRATE_POLICY
  1030.     x = PyInt_FromLong(CL_AWARE_BITRATE_POLICY);
  1031.     if (x == NULL || PyDict_SetItemString(d, "AWARE_BITRATE_POLICY", x) < 0)
  1032.         return;
  1033.     Py_DECREF(x);
  1034. #endif
  1035. #ifdef CL_AWARE_BITRATE_TARGET
  1036.     x = PyInt_FromLong(CL_AWARE_BITRATE_TARGET);
  1037.     if (x == NULL || PyDict_SetItemString(d, "AWARE_BITRATE_TARGET", x) < 0)
  1038.         return;
  1039.     Py_DECREF(x);
  1040. #endif
  1041. #ifdef CL_AWARE_CHANNEL_POLICY
  1042.     x = PyInt_FromLong(CL_AWARE_CHANNEL_POLICY);
  1043.     if (x == NULL || PyDict_SetItemString(d, "AWARE_CHANNEL_POLICY", x) < 0)
  1044.         return;
  1045.     Py_DECREF(x);
  1046. #endif
  1047. #ifdef CL_AWARE_CONST_QUAL
  1048.     x = PyInt_FromLong(CL_AWARE_CONST_QUAL);
  1049.     if (x == NULL || PyDict_SetItemString(d, "AWARE_CONST_QUAL", x) < 0)
  1050.         return;
  1051.     Py_DECREF(x);
  1052. #endif
  1053. #ifdef CL_AWARE_ERROR
  1054.     x = PyInt_FromLong(CL_AWARE_ERROR);
  1055.     if (x == NULL || PyDict_SetItemString(d, "AWARE_ERROR", x) < 0)
  1056.         return;
  1057.     Py_DECREF(x);
  1058. #endif
  1059. #ifdef CL_AWARE_FIXED_RATE
  1060.     x = PyInt_FromLong(CL_AWARE_FIXED_RATE);
  1061.     if (x == NULL || PyDict_SetItemString(d, "AWARE_FIXED_RATE", x) < 0)
  1062.         return;
  1063.     Py_DECREF(x);
  1064. #endif
  1065. #ifdef CL_AWARE_INDEPENDENT
  1066.     x = PyInt_FromLong(CL_AWARE_INDEPENDENT);
  1067.     if (x == NULL || PyDict_SetItemString(d, "AWARE_INDEPENDENT", x) < 0)
  1068.         return;
  1069.     Py_DECREF(x);
  1070. #endif
  1071. #ifdef CL_AWARE_JOINT_STEREO
  1072.     x = PyInt_FromLong(CL_AWARE_JOINT_STEREO);
  1073.     if (x == NULL || PyDict_SetItemString(d, "AWARE_JOINT_STEREO", x) < 0)
  1074.         return;
  1075.     Py_DECREF(x);
  1076. #endif
  1077. #ifdef CL_AWARE_LAYER
  1078.     x = PyInt_FromLong(CL_AWARE_LAYER);
  1079.     if (x == NULL || PyDict_SetItemString(d, "AWARE_LAYER", x) < 0)
  1080.         return;
  1081.     Py_DECREF(x);
  1082. #endif
  1083. #ifdef CL_AWARE_LOSSLESS
  1084.     x = PyInt_FromLong(CL_AWARE_LOSSLESS);
  1085.     if (x == NULL || PyDict_SetItemString(d, "AWARE_LOSSLESS", x) < 0)
  1086.         return;
  1087.     Py_DECREF(x);
  1088. #endif
  1089. #ifdef CL_AWARE_MPEG_AUDIO
  1090.     x = PyInt_FromLong(CL_AWARE_MPEG_AUDIO);
  1091.     if (x == NULL || PyDict_SetItemString(d, "AWARE_MPEG_AUDIO", x) < 0)
  1092.         return;
  1093.     Py_DECREF(x);
  1094. #endif
  1095. #ifdef CL_AWARE_MPEG_LAYER_I
  1096.     x = PyInt_FromLong(CL_AWARE_MPEG_LAYER_I);
  1097.     if (x == NULL || PyDict_SetItemString(d, "AWARE_MPEG_LAYER_I", x) < 0)
  1098.         return;
  1099.     Py_DECREF(x);
  1100. #endif
  1101. #ifdef CL_AWARE_MPEG_LAYER_II
  1102.     x = PyInt_FromLong(CL_AWARE_MPEG_LAYER_II);
  1103.     if (x == NULL || PyDict_SetItemString(d, "AWARE_MPEG_LAYER_II", x) < 0)
  1104.         return;
  1105.     Py_DECREF(x);
  1106. #endif
  1107. #ifdef CL_AWARE_MULTIRATE
  1108.     x = PyInt_FromLong(CL_AWARE_MULTIRATE);
  1109.     if (x == NULL || PyDict_SetItemString(d, "AWARE_MULTIRATE", x) < 0)
  1110.         return;
  1111.     Py_DECREF(x);
  1112. #endif
  1113. #ifdef CL_AWARE_NOISE_MARGIN
  1114.     x = PyInt_FromLong(CL_AWARE_NOISE_MARGIN);
  1115.     if (x == NULL || PyDict_SetItemString(d, "AWARE_NOISE_MARGIN", x) < 0)
  1116.         return;
  1117.     Py_DECREF(x);
  1118. #endif
  1119. #ifdef CL_AWARE_STEREO
  1120.     x = PyInt_FromLong(CL_AWARE_STEREO);
  1121.     if (x == NULL || PyDict_SetItemString(d, "AWARE_STEREO", x) < 0)
  1122.         return;
  1123.     Py_DECREF(x);
  1124. #endif
  1125. #ifdef CL_BAD_ALGORITHM_NAME
  1126.     x = PyInt_FromLong(CL_BAD_ALGORITHM_NAME);
  1127.     if (x == NULL || PyDict_SetItemString(d, "BAD_ALGORITHM_NAME", x) < 0)
  1128.         return;
  1129.     Py_DECREF(x);
  1130. #endif
  1131. #ifdef CL_BAD_ALGORITHM_TYPE
  1132.     x = PyInt_FromLong(CL_BAD_ALGORITHM_TYPE);
  1133.     if (x == NULL || PyDict_SetItemString(d, "BAD_ALGORITHM_TYPE", x) < 0)
  1134.         return;
  1135.     Py_DECREF(x);
  1136. #endif
  1137. #ifdef CL_BAD_BLOCK_SIZE
  1138.     x = PyInt_FromLong(CL_BAD_BLOCK_SIZE);
  1139.     if (x == NULL || PyDict_SetItemString(d, "BAD_BLOCK_SIZE", x) < 0)
  1140.         return;
  1141.     Py_DECREF(x);
  1142. #endif
  1143. #ifdef CL_BAD_BOARD
  1144.     x = PyInt_FromLong(CL_BAD_BOARD);
  1145.     if (x == NULL || PyDict_SetItemString(d, "BAD_BOARD", x) < 0)
  1146.         return;
  1147.     Py_DECREF(x);
  1148. #endif
  1149. #ifdef CL_BAD_BUFFERING
  1150.     x = PyInt_FromLong(CL_BAD_BUFFERING);
  1151.     if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERING", x) < 0)
  1152.         return;
  1153.     Py_DECREF(x);
  1154. #endif
  1155. #ifdef CL_BAD_BUFFERLENGTH_NEG
  1156.     x = PyInt_FromLong(CL_BAD_BUFFERLENGTH_NEG);
  1157.     if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_NEG", x) < 0)
  1158.         return;
  1159.     Py_DECREF(x);
  1160. #endif
  1161. #ifdef CL_BAD_BUFFERLENGTH_ODD
  1162.     x = PyInt_FromLong(CL_BAD_BUFFERLENGTH_ODD);
  1163.     if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_ODD", x) < 0)
  1164.         return;
  1165.     Py_DECREF(x);
  1166. #endif
  1167. #ifdef CL_BAD_BUFFER_EXISTS
  1168.     x = PyInt_FromLong(CL_BAD_BUFFER_EXISTS);
  1169.     if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_EXISTS", x) < 0)
  1170.         return;
  1171.     Py_DECREF(x);
  1172. #endif
  1173. #ifdef CL_BAD_BUFFER_HANDLE
  1174.     x = PyInt_FromLong(CL_BAD_BUFFER_HANDLE);
  1175.     if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_HANDLE", x) < 0)
  1176.         return;
  1177.     Py_DECREF(x);
  1178. #endif
  1179. #ifdef CL_BAD_BUFFER_POINTER
  1180.     x = PyInt_FromLong(CL_BAD_BUFFER_POINTER);
  1181.     if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_POINTER", x) < 0)
  1182.         return;
  1183.     Py_DECREF(x);
  1184. #endif
  1185. #ifdef CL_BAD_BUFFER_QUERY_SIZE
  1186.     x = PyInt_FromLong(CL_BAD_BUFFER_QUERY_SIZE);
  1187.     if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_QUERY_SIZE", x) < 0)
  1188.         return;
  1189.     Py_DECREF(x);
  1190. #endif
  1191. #ifdef CL_BAD_BUFFER_SIZE
  1192.     x = PyInt_FromLong(CL_BAD_BUFFER_SIZE);
  1193.     if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_SIZE", x) < 0)
  1194.         return;
  1195.     Py_DECREF(x);
  1196. #endif
  1197. #ifdef CL_BAD_BUFFER_SIZE_POINTER
  1198.     x = PyInt_FromLong(CL_BAD_BUFFER_SIZE_POINTER);
  1199.     if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_SIZE_POINTER", x) < 0)
  1200.         return;
  1201.     Py_DECREF(x);
  1202. #endif
  1203. #ifdef CL_BAD_BUFFER_TYPE
  1204.     x = PyInt_FromLong(CL_BAD_BUFFER_TYPE);
  1205.     if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_TYPE", x) < 0)
  1206.         return;
  1207.     Py_DECREF(x);
  1208. #endif
  1209. #ifdef CL_BAD_COMPRESSION_SCHEME
  1210.     x = PyInt_FromLong(CL_BAD_COMPRESSION_SCHEME);
  1211.     if (x == NULL || PyDict_SetItemString(d, "BAD_COMPRESSION_SCHEME", x) < 0)
  1212.         return;
  1213.     Py_DECREF(x);
  1214. #endif
  1215. #ifdef CL_BAD_COMPRESSOR_HANDLE
  1216.     x = PyInt_FromLong(CL_BAD_COMPRESSOR_HANDLE);
  1217.     if (x == NULL || PyDict_SetItemString(d, "BAD_COMPRESSOR_HANDLE", x) < 0)
  1218.         return;
  1219.     Py_DECREF(x);
  1220. #endif
  1221. #ifdef CL_BAD_COMPRESSOR_HANDLE_POINTER
  1222.     x = PyInt_FromLong(CL_BAD_COMPRESSOR_HANDLE_POINTER);
  1223.     if (x == NULL || PyDict_SetItemString(d, "BAD_COMPRESSOR_HANDLE_POINTER", x) < 0)
  1224.         return;
  1225.     Py_DECREF(x);
  1226. #endif
  1227. #ifdef CL_BAD_FRAME_SIZE
  1228.     x = PyInt_FromLong(CL_BAD_FRAME_SIZE);
  1229.     if (x == NULL || PyDict_SetItemString(d, "BAD_FRAME_SIZE", x) < 0)
  1230.         return;
  1231.     Py_DECREF(x);
  1232. #endif
  1233. #ifdef CL_BAD_FUNCTIONALITY
  1234.     x = PyInt_FromLong(CL_BAD_FUNCTIONALITY);
  1235.     if (x == NULL || PyDict_SetItemString(d, "BAD_FUNCTIONALITY", x) < 0)
  1236.         return;
  1237.     Py_DECREF(x);
  1238. #endif
  1239. #ifdef CL_BAD_FUNCTION_POINTER
  1240.     x = PyInt_FromLong(CL_BAD_FUNCTION_POINTER);
  1241.     if (x == NULL || PyDict_SetItemString(d, "BAD_FUNCTION_POINTER", x) < 0)
  1242.         return;
  1243.     Py_DECREF(x);
  1244. #endif
  1245. #ifdef CL_BAD_HEADER_SIZE
  1246.     x = PyInt_FromLong(CL_BAD_HEADER_SIZE);
  1247.     if (x == NULL || PyDict_SetItemString(d, "BAD_HEADER_SIZE", x) < 0)
  1248.         return;
  1249.     Py_DECREF(x);
  1250. #endif
  1251. #ifdef CL_BAD_INITIAL_VALUE
  1252.     x = PyInt_FromLong(CL_BAD_INITIAL_VALUE);
  1253.     if (x == NULL || PyDict_SetItemString(d, "BAD_INITIAL_VALUE", x) < 0)
  1254.         return;
  1255.     Py_DECREF(x);
  1256. #endif
  1257. #ifdef CL_BAD_INTERNAL_FORMAT
  1258.     x = PyInt_FromLong(CL_BAD_INTERNAL_FORMAT);
  1259.     if (x == NULL || PyDict_SetItemString(d, "BAD_INTERNAL_FORMAT", x) < 0)
  1260.         return;
  1261.     Py_DECREF(x);
  1262. #endif
  1263. #ifdef CL_BAD_LICENSE
  1264.     x = PyInt_FromLong(CL_BAD_LICENSE);
  1265.     if (x == NULL || PyDict_SetItemString(d, "BAD_LICENSE", x) < 0)
  1266.         return;
  1267.     Py_DECREF(x);
  1268. #endif
  1269. #ifdef CL_BAD_MIN_GT_MAX
  1270.     x = PyInt_FromLong(CL_BAD_MIN_GT_MAX);
  1271.     if (x == NULL || PyDict_SetItemString(d, "BAD_MIN_GT_MAX", x) < 0)
  1272.         return;
  1273.     Py_DECREF(x);
  1274. #endif
  1275. #ifdef CL_BAD_NO_BUFFERSPACE
  1276.     x = PyInt_FromLong(CL_BAD_NO_BUFFERSPACE);
  1277.     if (x == NULL || PyDict_SetItemString(d, "BAD_NO_BUFFERSPACE", x) < 0)
  1278.         return;
  1279.     Py_DECREF(x);
  1280. #endif
  1281. #ifdef CL_BAD_NUMBER_OF_BLOCKS
  1282.     x = PyInt_FromLong(CL_BAD_NUMBER_OF_BLOCKS);
  1283.     if (x == NULL || PyDict_SetItemString(d, "BAD_NUMBER_OF_BLOCKS", x) < 0)
  1284.         return;
  1285.     Py_DECREF(x);
  1286. #endif
  1287. #ifdef CL_BAD_PARAM
  1288.     x = PyInt_FromLong(CL_BAD_PARAM);
  1289.     if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM", x) < 0)
  1290.         return;
  1291.     Py_DECREF(x);
  1292. #endif
  1293. #ifdef CL_BAD_PARAM_ID_POINTER
  1294.     x = PyInt_FromLong(CL_BAD_PARAM_ID_POINTER);
  1295.     if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM_ID_POINTER", x) < 0)
  1296.         return;
  1297.     Py_DECREF(x);
  1298. #endif
  1299. #ifdef CL_BAD_PARAM_TYPE
  1300.     x = PyInt_FromLong(CL_BAD_PARAM_TYPE);
  1301.     if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM_TYPE", x) < 0)
  1302.         return;
  1303.     Py_DECREF(x);
  1304. #endif
  1305. #ifdef CL_BAD_POINTER
  1306.     x = PyInt_FromLong(CL_BAD_POINTER);
  1307.     if (x == NULL || PyDict_SetItemString(d, "BAD_POINTER", x) < 0)
  1308.         return;
  1309.     Py_DECREF(x);
  1310. #endif
  1311. #ifdef CL_BAD_PVBUFFER
  1312.     x = PyInt_FromLong(CL_BAD_PVBUFFER);
  1313.     if (x == NULL || PyDict_SetItemString(d, "BAD_PVBUFFER", x) < 0)
  1314.         return;
  1315.     Py_DECREF(x);
  1316. #endif
  1317. #ifdef CL_BAD_SCHEME_POINTER
  1318.     x = PyInt_FromLong(CL_BAD_SCHEME_POINTER);
  1319.     if (x == NULL || PyDict_SetItemString(d, "BAD_SCHEME_POINTER", x) < 0)
  1320.         return;
  1321.     Py_DECREF(x);
  1322. #endif
  1323. #ifdef CL_BAD_STREAM_HEADER
  1324.     x = PyInt_FromLong(CL_BAD_STREAM_HEADER);
  1325.     if (x == NULL || PyDict_SetItemString(d, "BAD_STREAM_HEADER", x) < 0)
  1326.         return;
  1327.     Py_DECREF(x);
  1328. #endif
  1329. #ifdef CL_BAD_STRING_POINTER
  1330.     x = PyInt_FromLong(CL_BAD_STRING_POINTER);
  1331.     if (x == NULL || PyDict_SetItemString(d, "BAD_STRING_POINTER", x) < 0)
  1332.         return;
  1333.     Py_DECREF(x);
  1334. #endif
  1335. #ifdef CL_BAD_TEXT_STRING_PTR
  1336.     x = PyInt_FromLong(CL_BAD_TEXT_STRING_PTR);
  1337.     if (x == NULL || PyDict_SetItemString(d, "BAD_TEXT_STRING_PTR", x) < 0)
  1338.         return;
  1339.     Py_DECREF(x);
  1340. #endif
  1341. #ifdef CL_BEST_FIT
  1342.     x = PyInt_FromLong(CL_BEST_FIT);
  1343.     if (x == NULL || PyDict_SetItemString(d, "BEST_FIT", x) < 0)
  1344.         return;
  1345.     Py_DECREF(x);
  1346. #endif
  1347. #ifdef CL_BIDIRECTIONAL
  1348.     x = PyInt_FromLong(CL_BIDIRECTIONAL);
  1349.     if (x == NULL || PyDict_SetItemString(d, "BIDIRECTIONAL", x) < 0)
  1350.         return;
  1351.     Py_DECREF(x);
  1352. #endif
  1353. #ifdef CL_BITRATE
  1354.     x = PyInt_FromLong(CL_BITRATE);
  1355.     if (x == NULL || PyDict_SetItemString(d, "BITRATE", x) < 0)
  1356.         return;
  1357.     Py_DECREF(x);
  1358. #endif
  1359. #ifdef CL_BITRATE_POLICY
  1360.     x = PyInt_FromLong(CL_BITRATE_POLICY);
  1361.     if (x == NULL || PyDict_SetItemString(d, "BITRATE_POLICY", x) < 0)
  1362.         return;
  1363.     Py_DECREF(x);
  1364. #endif
  1365. #ifdef CL_BITRATE_TARGET
  1366.     x = PyInt_FromLong(CL_BITRATE_TARGET);
  1367.     if (x == NULL || PyDict_SetItemString(d, "BITRATE_TARGET", x) < 0)
  1368.         return;
  1369.     Py_DECREF(x);
  1370. #endif
  1371. #ifdef CL_BITS_PER_COMPONENT
  1372.     x = PyInt_FromLong(CL_BITS_PER_COMPONENT);
  1373.     if (x == NULL || PyDict_SetItemString(d, "BITS_PER_COMPONENT", x) < 0)
  1374.         return;
  1375.     Py_DECREF(x);
  1376. #endif
  1377. #ifdef CL_BLENDING
  1378.     x = PyInt_FromLong(CL_BLENDING);
  1379.     if (x == NULL || PyDict_SetItemString(d, "BLENDING", x) < 0)
  1380.         return;
  1381.     Py_DECREF(x);
  1382. #endif
  1383. #ifdef CL_BLOCK_SIZE
  1384.     x = PyInt_FromLong(CL_BLOCK_SIZE);
  1385.     if (x == NULL || PyDict_SetItemString(d, "BLOCK_SIZE", x) < 0)
  1386.         return;
  1387.     Py_DECREF(x);
  1388. #endif
  1389. #ifdef CL_BOTTOM_UP
  1390.     x = PyInt_FromLong(CL_BOTTOM_UP);
  1391.     if (x == NULL || PyDict_SetItemString(d, "BOTTOM_UP", x) < 0)
  1392.         return;
  1393.     Py_DECREF(x);
  1394. #endif
  1395. #ifdef CL_BUFFER_NOT_CREATED
  1396.     x = PyInt_FromLong(CL_BUFFER_NOT_CREATED);
  1397.     if (x == NULL || PyDict_SetItemString(d, "BUFFER_NOT_CREATED", x) < 0)
  1398.         return;
  1399.     Py_DECREF(x);
  1400. #endif
  1401. #ifdef CL_BUF_COMPRESSED
  1402.     x = PyInt_FromLong(CL_BUF_COMPRESSED);
  1403.     if (x == NULL || PyDict_SetItemString(d, "BUF_COMPRESSED", x) < 0)
  1404.         return;
  1405.     Py_DECREF(x);
  1406. #endif
  1407. #ifdef CL_BUF_DATA
  1408.     x = PyInt_FromLong(CL_BUF_DATA);
  1409.     if (x == NULL || PyDict_SetItemString(d, "BUF_DATA", x) < 0)
  1410.         return;
  1411.     Py_DECREF(x);
  1412. #endif
  1413. #ifdef CL_BUF_FRAME
  1414.     x = PyInt_FromLong(CL_BUF_FRAME);
  1415.     if (x == NULL || PyDict_SetItemString(d, "BUF_FRAME", x) < 0)
  1416.         return;
  1417.     Py_DECREF(x);
  1418. #endif
  1419. #ifdef CL_CHANNEL_POLICY
  1420.     x = PyInt_FromLong(CL_CHANNEL_POLICY);
  1421.     if (x == NULL || PyDict_SetItemString(d, "CHANNEL_POLICY", x) < 0)
  1422.         return;
  1423.     Py_DECREF(x);
  1424. #endif
  1425. #ifdef CL_CHROMA_THRESHOLD
  1426.     x = PyInt_FromLong(CL_CHROMA_THRESHOLD);
  1427.     if (x == NULL || PyDict_SetItemString(d, "CHROMA_THRESHOLD", x) < 0)
  1428.         return;
  1429.     Py_DECREF(x);
  1430. #endif
  1431. #ifdef CL_CODEC
  1432.     x = PyInt_FromLong(CL_CODEC);
  1433.     if (x == NULL || PyDict_SetItemString(d, "CODEC", x) < 0)
  1434.         return;
  1435.     Py_DECREF(x);
  1436. #endif
  1437. #ifdef CL_COMPONENTS
  1438.     x = PyInt_FromLong(CL_COMPONENTS);
  1439.     if (x == NULL || PyDict_SetItemString(d, "COMPONENTS", x) < 0)
  1440.         return;
  1441.     Py_DECREF(x);
  1442. #endif
  1443. #ifdef CL_COMPRESSED_BUFFER_SIZE
  1444.     x = PyInt_FromLong(CL_COMPRESSED_BUFFER_SIZE);
  1445.     if (x == NULL || PyDict_SetItemString(d, "COMPRESSED_BUFFER_SIZE", x) < 0)
  1446.         return;
  1447.     Py_DECREF(x);
  1448. #endif
  1449. #ifdef CL_COMPRESSION_RATIO
  1450.     x = PyInt_FromLong(CL_COMPRESSION_RATIO);
  1451.     if (x == NULL || PyDict_SetItemString(d, "COMPRESSION_RATIO", x) < 0)
  1452.         return;
  1453.     Py_DECREF(x);
  1454. #endif
  1455. #ifdef CL_COMPRESSOR
  1456.     x = PyInt_FromLong(CL_COMPRESSOR);
  1457.     if (x == NULL || PyDict_SetItemString(d, "COMPRESSOR", x) < 0)
  1458.         return;
  1459.     Py_DECREF(x);
  1460. #endif
  1461. #ifdef CL_CONTINUOUS_BLOCK
  1462.     x = PyInt_FromLong(CL_CONTINUOUS_BLOCK);
  1463.     if (x == NULL || PyDict_SetItemString(d, "CONTINUOUS_BLOCK", x) < 0)
  1464.         return;
  1465.     Py_DECREF(x);
  1466. #endif
  1467. #ifdef CL_CONTINUOUS_NONBLOCK
  1468.     x = PyInt_FromLong(CL_CONTINUOUS_NONBLOCK);
  1469.     if (x == NULL || PyDict_SetItemString(d, "CONTINUOUS_NONBLOCK", x) < 0)
  1470.         return;
  1471.     Py_DECREF(x);
  1472. #endif
  1473. #ifdef CL_COSMO_CODEC_CONTROL
  1474.     x = PyInt_FromLong(CL_COSMO_CODEC_CONTROL);
  1475.     if (x == NULL || PyDict_SetItemString(d, "COSMO_CODEC_CONTROL", x) < 0)
  1476.         return;
  1477.     Py_DECREF(x);
  1478. #endif
  1479. #ifdef CL_COSMO_NUM_PARAMS
  1480.     x = PyInt_FromLong(CL_COSMO_NUM_PARAMS);
  1481.     if (x == NULL || PyDict_SetItemString(d, "COSMO_NUM_PARAMS", x) < 0)
  1482.         return;
  1483.     Py_DECREF(x);
  1484. #endif
  1485. #ifdef CL_COSMO_VALUE_BASE
  1486.     x = PyInt_FromLong(CL_COSMO_VALUE_BASE);
  1487.     if (x == NULL || PyDict_SetItemString(d, "COSMO_VALUE_BASE", x) < 0)
  1488.         return;
  1489.     Py_DECREF(x);
  1490. #endif
  1491. #ifdef CL_COSMO_VIDEO_MANUAL_CONTROL
  1492.     x = PyInt_FromLong(CL_COSMO_VIDEO_MANUAL_CONTROL);
  1493.     if (x == NULL || PyDict_SetItemString(d, "COSMO_VIDEO_MANUAL_CONTROL", x) < 0)
  1494.         return;
  1495.     Py_DECREF(x);
  1496. #endif
  1497. #ifdef CL_COSMO_VIDEO_TRANSFER_MODE
  1498.     x = PyInt_FromLong(CL_COSMO_VIDEO_TRANSFER_MODE);
  1499.     if (x == NULL || PyDict_SetItemString(d, "COSMO_VIDEO_TRANSFER_MODE", x) < 0)
  1500.         return;
  1501.     Py_DECREF(x);
  1502. #endif
  1503. #ifdef CL_DATA
  1504.     x = PyInt_FromLong(CL_DATA);
  1505.     if (x == NULL || PyDict_SetItemString(d, "DATA", x) < 0)
  1506.         return;
  1507.     Py_DECREF(x);
  1508. #endif
  1509. #ifdef CL_DECOMPRESSOR
  1510.     x = PyInt_FromLong(CL_DECOMPRESSOR);
  1511.     if (x == NULL || PyDict_SetItemString(d, "DECOMPRESSOR", x) < 0)
  1512.         return;
  1513.     Py_DECREF(x);
  1514. #endif
  1515. #ifdef CL_DSO_ERROR
  1516.     x = PyInt_FromLong(CL_DSO_ERROR);
  1517.     if (x == NULL || PyDict_SetItemString(d, "DSO_ERROR", x) < 0)
  1518.         return;
  1519.     Py_DECREF(x);
  1520. #endif
  1521. #ifdef CL_EDGE_THRESHOLD
  1522.     x = PyInt_FromLong(CL_EDGE_THRESHOLD);
  1523.     if (x == NULL || PyDict_SetItemString(d, "EDGE_THRESHOLD", x) < 0)
  1524.         return;
  1525.     Py_DECREF(x);
  1526. #endif
  1527. #ifdef CL_ENABLE_IMAGEINFO
  1528.     x = PyInt_FromLong(CL_ENABLE_IMAGEINFO);
  1529.     if (x == NULL || PyDict_SetItemString(d, "ENABLE_IMAGEINFO", x) < 0)
  1530.         return;
  1531.     Py_DECREF(x);
  1532. #endif
  1533. #ifdef CL_END_OF_SEQUENCE
  1534.     x = PyInt_FromLong(CL_END_OF_SEQUENCE);
  1535.     if (x == NULL || PyDict_SetItemString(d, "END_OF_SEQUENCE", x) < 0)
  1536.         return;
  1537.     Py_DECREF(x);
  1538. #endif
  1539. #ifdef CL_ENUM_VALUE
  1540.     x = PyInt_FromLong(CL_ENUM_VALUE);
  1541.     if (x == NULL || PyDict_SetItemString(d, "ENUM_VALUE", x) < 0)
  1542.         return;
  1543.     Py_DECREF(x);
  1544. #endif
  1545. #ifdef CL_EXACT_COMPRESSION_RATIO
  1546.     x = PyInt_FromLong(CL_EXACT_COMPRESSION_RATIO);
  1547.     if (x == NULL || PyDict_SetItemString(d, "EXACT_COMPRESSION_RATIO", x) < 0)
  1548.         return;
  1549.     Py_DECREF(x);
  1550. #endif
  1551. #ifdef CL_EXTERNAL_DEVICE
  1552.     x = PyInt_FromLong((long) CL_EXTERNAL_DEVICE);
  1553.     if (x == NULL || PyDict_SetItemString(d, "EXTERNAL_DEVICE", x) < 0)
  1554.         return;
  1555.     Py_DECREF(x);
  1556. #endif
  1557. #ifdef CL_FLOATING_ENUM_VALUE
  1558.     x = PyInt_FromLong(CL_FLOATING_ENUM_VALUE);
  1559.     if (x == NULL || PyDict_SetItemString(d, "FLOATING_ENUM_VALUE", x) < 0)
  1560.         return;
  1561.     Py_DECREF(x);
  1562. #endif
  1563. #ifdef CL_FLOATING_RANGE_VALUE
  1564.     x = PyInt_FromLong(CL_FLOATING_RANGE_VALUE);
  1565.     if (x == NULL || PyDict_SetItemString(d, "FLOATING_RANGE_VALUE", x) < 0)
  1566.         return;
  1567.     Py_DECREF(x);
  1568. #endif
  1569. #ifdef CL_FORMAT
  1570.     x = PyInt_FromLong(CL_FORMAT);
  1571.     if (x == NULL || PyDict_SetItemString(d, "FORMAT", x) < 0)
  1572.         return;
  1573.     Py_DECREF(x);
  1574. #endif
  1575. #ifdef CL_FORMAT_ABGR
  1576.     x = PyInt_FromLong(CL_FORMAT_ABGR);
  1577.     if (x == NULL || PyDict_SetItemString(d, "FORMAT_ABGR", x) < 0)
  1578.         return;
  1579.     Py_DECREF(x);
  1580. #endif
  1581. #ifdef CL_FORMAT_BGR
  1582.     x = PyInt_FromLong(CL_FORMAT_BGR);
  1583.     if (x == NULL || PyDict_SetItemString(d, "FORMAT_BGR", x) < 0)
  1584.         return;
  1585.     Py_DECREF(x);
  1586. #endif
  1587. #ifdef CL_FORMAT_BGR233
  1588.     x = PyInt_FromLong(CL_FORMAT_BGR233);
  1589.     if (x == NULL || PyDict_SetItemString(d, "FORMAT_BGR233", x) < 0)
  1590.         return;
  1591.     Py_DECREF(x);
  1592. #endif
  1593. #ifdef CL_FORMAT_GRAYSCALE
  1594.     x = PyInt_FromLong(CL_FORMAT_GRAYSCALE);
  1595.     if (x == NULL || PyDict_SetItemString(d, "FORMAT_GRAYSCALE", x) < 0)
  1596.         return;
  1597.     Py_DECREF(x);
  1598. #endif
  1599. #ifdef CL_FORMAT_MONO
  1600.     x = PyInt_FromLong(CL_FORMAT_MONO);
  1601.     if (x == NULL || PyDict_SetItemString(d, "FORMAT_MONO", x) < 0)
  1602.         return;
  1603.     Py_DECREF(x);
  1604. #endif
  1605. #ifdef CL_FORMAT_RBG323
  1606.     x = PyInt_FromLong(CL_FORMAT_RBG323);
  1607.     if (x == NULL || PyDict_SetItemString(d, "FORMAT_RBG323", x) < 0)
  1608.         return;
  1609.     Py_DECREF(x);
  1610. #endif
  1611. #ifdef CL_FORMAT_STEREO_INTERLEAVED
  1612.     x = PyInt_FromLong(CL_FORMAT_STEREO_INTERLEAVED);
  1613.     if (x == NULL || PyDict_SetItemString(d, "FORMAT_STEREO_INTERLEAVED", x) < 0)
  1614.         return;
  1615.     Py_DECREF(x);
  1616. #endif
  1617. #ifdef CL_FORMAT_XBGR
  1618.     x = PyInt_FromLong(CL_FORMAT_XBGR);
  1619.     if (x == NULL || PyDict_SetItemString(d, "FORMAT_XBGR", x) < 0)
  1620.         return;
  1621.     Py_DECREF(x);
  1622. #endif
  1623. #ifdef CL_FORMAT_YCbCr
  1624.     x = PyInt_FromLong(CL_FORMAT_YCbCr);
  1625.     if (x == NULL || PyDict_SetItemString(d, "FORMAT_YCbCr", x) < 0)
  1626.         return;
  1627.     Py_DECREF(x);
  1628. #endif
  1629. #ifdef CL_FORMAT_YCbCr422
  1630.     x = PyInt_FromLong(CL_FORMAT_YCbCr422);
  1631.     if (x == NULL || PyDict_SetItemString(d, "FORMAT_YCbCr422", x) < 0)
  1632.         return;
  1633.     Py_DECREF(x);
  1634. #endif
  1635. #ifdef CL_FORMAT_YCbCr422DC
  1636.     x = PyInt_FromLong(CL_FORMAT_YCbCr422DC);
  1637.     if (x == NULL || PyDict_SetItemString(d, "FORMAT_YCbCr422DC", x) < 0)
  1638.         return;
  1639.     Py_DECREF(x);
  1640. #endif
  1641. #ifdef CL_FRAME
  1642.     x = PyInt_FromLong(CL_FRAME);
  1643.     if (x == NULL || PyDict_SetItemString(d, "FRAME", x) < 0)
  1644.         return;
  1645.     Py_DECREF(x);
  1646. #endif
  1647. #ifdef CL_FRAMES_PER_CHUNK
  1648.     x = PyInt_FromLong(CL_FRAMES_PER_CHUNK);
  1649.     if (x == NULL || PyDict_SetItemString(d, "FRAMES_PER_CHUNK", x) < 0)
  1650.         return;
  1651.     Py_DECREF(x);
  1652. #endif
  1653. #ifdef CL_FRAME_BUFFER_SIZE
  1654.     x = PyInt_FromLong(CL_FRAME_BUFFER_SIZE);
  1655.     if (x == NULL || PyDict_SetItemString(d, "FRAME_BUFFER_SIZE", x) < 0)
  1656.         return;
  1657.     Py_DECREF(x);
  1658. #endif
  1659. #ifdef CL_FRAME_BUFFER_SIZE_ZERO
  1660.     x = PyInt_FromLong(CL_FRAME_BUFFER_SIZE_ZERO);
  1661.     if (x == NULL || PyDict_SetItemString(d, "FRAME_BUFFER_SIZE_ZERO", x) < 0)
  1662.         return;
  1663.     Py_DECREF(x);
  1664. #endif
  1665. #ifdef CL_FRAME_INDEX
  1666.     x = PyInt_FromLong(CL_FRAME_INDEX);
  1667.     if (x == NULL || PyDict_SetItemString(d, "FRAME_INDEX", x) < 0)
  1668.         return;
  1669.     Py_DECREF(x);
  1670. #endif
  1671. #ifdef CL_FRAME_RATE
  1672.     x = PyInt_FromLong(CL_FRAME_RATE);
  1673.     if (x == NULL || PyDict_SetItemString(d, "FRAME_RATE", x) < 0)
  1674.         return;
  1675.     Py_DECREF(x);
  1676. #endif
  1677. #ifdef CL_FRAME_SIZE
  1678.     x = PyInt_FromLong(CL_FRAME_SIZE);
  1679.     if (x == NULL || PyDict_SetItemString(d, "FRAME_SIZE", x) < 0)
  1680.         return;
  1681.     Py_DECREF(x);
  1682. #endif
  1683. #ifdef CL_FRAME_TYPE
  1684.     x = PyInt_FromLong(CL_FRAME_TYPE);
  1685.     if (x == NULL || PyDict_SetItemString(d, "FRAME_TYPE", x) < 0)
  1686.         return;
  1687.     Py_DECREF(x);
  1688. #endif
  1689. #ifdef CL_G711_ALAW
  1690.     x = PyInt_FromLong(CL_G711_ALAW);
  1691.     if (x == NULL || PyDict_SetItemString(d, "G711_ALAW", x) < 0)
  1692.         return;
  1693.     Py_DECREF(x);
  1694. #endif
  1695. #ifdef CL_G711_ALAW_SOFTWARE
  1696.     x = PyInt_FromLong(CL_G711_ALAW_SOFTWARE);
  1697.     if (x == NULL || PyDict_SetItemString(d, "G711_ALAW_SOFTWARE", x) < 0)
  1698.         return;
  1699.     Py_DECREF(x);
  1700. #endif
  1701. #ifdef CL_G711_ULAW
  1702.     x = PyInt_FromLong(CL_G711_ULAW);
  1703.     if (x == NULL || PyDict_SetItemString(d, "G711_ULAW", x) < 0)
  1704.         return;
  1705.     Py_DECREF(x);
  1706. #endif
  1707. #ifdef CL_G711_ULAW_SOFTWARE
  1708.     x = PyInt_FromLong(CL_G711_ULAW_SOFTWARE);
  1709.     if (x == NULL || PyDict_SetItemString(d, "G711_ULAW_SOFTWARE", x) < 0)
  1710.         return;
  1711.     Py_DECREF(x);
  1712. #endif
  1713. #ifdef CL_GRAYSCALE
  1714.     x = PyInt_FromLong(CL_GRAYSCALE);
  1715.     if (x == NULL || PyDict_SetItemString(d, "GRAYSCALE", x) < 0)
  1716.         return;
  1717.     Py_DECREF(x);
  1718. #endif
  1719. #ifdef CL_HDCC
  1720.     x = PyInt_FromLong(CL_HDCC);
  1721.     if (x == NULL || PyDict_SetItemString(d, "HDCC", x) < 0)
  1722.         return;
  1723.     Py_DECREF(x);
  1724. #endif
  1725. #ifdef CL_HDCC_SAMPLES_PER_TILE
  1726.     x = PyInt_FromLong(CL_HDCC_SAMPLES_PER_TILE);
  1727.     if (x == NULL || PyDict_SetItemString(d, "HDCC_SAMPLES_PER_TILE", x) < 0)
  1728.         return;
  1729.     Py_DECREF(x);
  1730. #endif
  1731. #ifdef CL_HDCC_SOFTWARE
  1732.     x = PyInt_FromLong(CL_HDCC_SOFTWARE);
  1733.     if (x == NULL || PyDict_SetItemString(d, "HDCC_SOFTWARE", x) < 0)
  1734.         return;
  1735.     Py_DECREF(x);
  1736. #endif
  1737. #ifdef CL_HDCC_TILE_THRESHOLD
  1738.     x = PyInt_FromLong(CL_HDCC_TILE_THRESHOLD);
  1739.     if (x == NULL || PyDict_SetItemString(d, "HDCC_TILE_THRESHOLD", x) < 0)
  1740.         return;
  1741.     Py_DECREF(x);
  1742. #endif
  1743. #ifdef CL_HEADER_START_CODE
  1744.     x = PyInt_FromLong(CL_HEADER_START_CODE);
  1745.     if (x == NULL || PyDict_SetItemString(d, "HEADER_START_CODE", x) < 0)
  1746.         return;
  1747.     Py_DECREF(x);
  1748. #endif
  1749. #ifdef CL_IMAGEINFO_FIELDMASK
  1750.     x = PyInt_FromLong(CL_IMAGEINFO_FIELDMASK);
  1751.     if (x == NULL || PyDict_SetItemString(d, "IMAGEINFO_FIELDMASK", x) < 0)
  1752.         return;
  1753.     Py_DECREF(x);
  1754. #endif
  1755. #ifdef CL_IMAGE_CROP_BOTTOM
  1756.     x = PyInt_FromLong(CL_IMAGE_CROP_BOTTOM);
  1757.     if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_BOTTOM", x) < 0)
  1758.         return;
  1759.     Py_DECREF(x);
  1760. #endif
  1761. #ifdef CL_IMAGE_CROP_LEFT
  1762.     x = PyInt_FromLong(CL_IMAGE_CROP_LEFT);
  1763.     if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_LEFT", x) < 0)
  1764.         return;
  1765.     Py_DECREF(x);
  1766. #endif
  1767. #ifdef CL_IMAGE_CROP_RIGHT
  1768.     x = PyInt_FromLong(CL_IMAGE_CROP_RIGHT);
  1769.     if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_RIGHT", x) < 0)
  1770.         return;
  1771.     Py_DECREF(x);
  1772. #endif
  1773. #ifdef CL_IMAGE_CROP_TOP
  1774.     x = PyInt_FromLong(CL_IMAGE_CROP_TOP);
  1775.     if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_TOP", x) < 0)
  1776.         return;
  1777.     Py_DECREF(x);
  1778. #endif
  1779. #ifdef CL_IMAGE_HEIGHT
  1780.     x = PyInt_FromLong(CL_IMAGE_HEIGHT);
  1781.     if (x == NULL || PyDict_SetItemString(d, "IMAGE_HEIGHT", x) < 0)
  1782.         return;
  1783.     Py_DECREF(x);
  1784. #endif
  1785. #ifdef CL_IMAGE_WIDTH
  1786.     x = PyInt_FromLong(CL_IMAGE_WIDTH);
  1787.     if (x == NULL || PyDict_SetItemString(d, "IMAGE_WIDTH", x) < 0)
  1788.         return;
  1789.     Py_DECREF(x);
  1790. #endif
  1791. #ifdef CL_IMPACT_CODEC_CONTROL
  1792.     x = PyInt_FromLong(CL_IMPACT_CODEC_CONTROL);
  1793.     if (x == NULL || PyDict_SetItemString(d, "IMPACT_CODEC_CONTROL", x) < 0)
  1794.         return;
  1795.     Py_DECREF(x);
  1796. #endif
  1797. #ifdef CL_IMPACT_FRAME_INTERLEAVE
  1798.     x = PyInt_FromLong(CL_IMPACT_FRAME_INTERLEAVE);
  1799.     if (x == NULL || PyDict_SetItemString(d, "IMPACT_FRAME_INTERLEAVE", x) < 0)
  1800.         return;
  1801.     Py_DECREF(x);
  1802. #endif
  1803. #ifdef CL_IMPACT_NUM_PARAMS
  1804.     x = PyInt_FromLong(CL_IMPACT_NUM_PARAMS);
  1805.     if (x == NULL || PyDict_SetItemString(d, "IMPACT_NUM_PARAMS", x) < 0)
  1806.         return;
  1807.     Py_DECREF(x);
  1808. #endif
  1809. #ifdef CL_INTERNAL_FORMAT
  1810.     x = PyInt_FromLong(CL_INTERNAL_FORMAT);
  1811.     if (x == NULL || PyDict_SetItemString(d, "INTERNAL_FORMAT", x) < 0)
  1812.         return;
  1813.     Py_DECREF(x);
  1814. #endif
  1815. #ifdef CL_INTERNAL_IMAGE_HEIGHT
  1816.     x = PyInt_FromLong(CL_INTERNAL_IMAGE_HEIGHT);
  1817.     if (x == NULL || PyDict_SetItemString(d, "INTERNAL_IMAGE_HEIGHT", x) < 0)
  1818.         return;
  1819.     Py_DECREF(x);
  1820. #endif
  1821. #ifdef CL_INTERNAL_IMAGE_WIDTH
  1822.     x = PyInt_FromLong(CL_INTERNAL_IMAGE_WIDTH);
  1823.     if (x == NULL || PyDict_SetItemString(d, "INTERNAL_IMAGE_WIDTH", x) < 0)
  1824.         return;
  1825.     Py_DECREF(x);
  1826. #endif
  1827. #ifdef CL_INTRA
  1828.     x = PyInt_FromLong(CL_INTRA);
  1829.     if (x == NULL || PyDict_SetItemString(d, "INTRA", x) < 0)
  1830.         return;
  1831.     Py_DECREF(x);
  1832. #endif
  1833. #ifdef CL_JPEG
  1834.     x = PyInt_FromLong(CL_JPEG);
  1835.     if (x == NULL || PyDict_SetItemString(d, "JPEG", x) < 0)
  1836.         return;
  1837.     Py_DECREF(x);
  1838. #endif
  1839. #ifdef CL_JPEG_COSMO
  1840.     x = PyInt_FromLong(CL_JPEG_COSMO);
  1841.     if (x == NULL || PyDict_SetItemString(d, "JPEG_COSMO", x) < 0)
  1842.         return;
  1843.     Py_DECREF(x);
  1844. #endif
  1845. #ifdef CL_JPEG_ERROR
  1846.     x = PyInt_FromLong(CL_JPEG_ERROR);
  1847.     if (x == NULL || PyDict_SetItemString(d, "JPEG_ERROR", x) < 0)
  1848.         return;
  1849.     Py_DECREF(x);
  1850. #endif
  1851. #ifdef CL_JPEG_IMPACT
  1852.     x = PyInt_FromLong(CL_JPEG_IMPACT);
  1853.     if (x == NULL || PyDict_SetItemString(d, "JPEG_IMPACT", x) < 0)
  1854.         return;
  1855.     Py_DECREF(x);
  1856. #endif
  1857. #ifdef CL_JPEG_NUM_PARAMS
  1858.     x = PyInt_FromLong(CL_JPEG_NUM_PARAMS);
  1859.     if (x == NULL || PyDict_SetItemString(d, "JPEG_NUM_PARAMS", x) < 0)
  1860.         return;
  1861.     Py_DECREF(x);
  1862. #endif
  1863. #ifdef CL_JPEG_QUALITY_FACTOR
  1864.     x = PyInt_FromLong(CL_JPEG_QUALITY_FACTOR);
  1865.     if (x == NULL || PyDict_SetItemString(d, "JPEG_QUALITY_FACTOR", x) < 0)
  1866.         return;
  1867.     Py_DECREF(x);
  1868. #endif
  1869. #ifdef CL_JPEG_QUANTIZATION_TABLES
  1870.     x = PyInt_FromLong(CL_JPEG_QUANTIZATION_TABLES);
  1871.     if (x == NULL || PyDict_SetItemString(d, "JPEG_QUANTIZATION_TABLES", x) < 0)
  1872.         return;
  1873.     Py_DECREF(x);
  1874. #endif
  1875. #ifdef CL_JPEG_SOFTWARE
  1876.     x = PyInt_FromLong(CL_JPEG_SOFTWARE);
  1877.     if (x == NULL || PyDict_SetItemString(d, "JPEG_SOFTWARE", x) < 0)
  1878.         return;
  1879.     Py_DECREF(x);
  1880. #endif
  1881. #ifdef CL_JPEG_STREAM_HEADERS
  1882.     x = PyInt_FromLong(CL_JPEG_STREAM_HEADERS);
  1883.     if (x == NULL || PyDict_SetItemString(d, "JPEG_STREAM_HEADERS", x) < 0)
  1884.         return;
  1885.     Py_DECREF(x);
  1886. #endif
  1887. #ifdef CL_KEYFRAME
  1888.     x = PyInt_FromLong(CL_KEYFRAME);
  1889.     if (x == NULL || PyDict_SetItemString(d, "KEYFRAME", x) < 0)
  1890.         return;
  1891.     Py_DECREF(x);
  1892. #endif
  1893. #ifdef CL_KEYFRAME_DISTANCE
  1894.     x = PyInt_FromLong(CL_KEYFRAME_DISTANCE);
  1895.     if (x == NULL || PyDict_SetItemString(d, "KEYFRAME_DISTANCE", x) < 0)
  1896.         return;
  1897.     Py_DECREF(x);
  1898. #endif
  1899. #ifdef CL_LAST_FRAME_INDEX
  1900.     x = PyInt_FromLong(CL_LAST_FRAME_INDEX);
  1901.     if (x == NULL || PyDict_SetItemString(d, "LAST_FRAME_INDEX", x) < 0)
  1902.         return;
  1903.     Py_DECREF(x);
  1904. #endif
  1905. #ifdef CL_LAYER
  1906.     x = PyInt_FromLong(CL_LAYER);
  1907.     if (x == NULL || PyDict_SetItemString(d, "LAYER", x) < 0)
  1908.         return;
  1909.     Py_DECREF(x);
  1910. #endif
  1911. #ifdef CL_LUMA_THRESHOLD
  1912.     x = PyInt_FromLong(CL_LUMA_THRESHOLD);
  1913.     if (x == NULL || PyDict_SetItemString(d, "LUMA_THRESHOLD", x) < 0)
  1914.         return;
  1915.     Py_DECREF(x);
  1916. #endif
  1917. #ifdef CL_MAX_NUMBER_OF_AUDIO_ALGORITHMS
  1918.     x = PyInt_FromLong(CL_MAX_NUMBER_OF_AUDIO_ALGORITHMS);
  1919.     if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_AUDIO_ALGORITHMS", x) < 0)
  1920.         return;
  1921.     Py_DECREF(x);
  1922. #endif
  1923. #ifdef CL_MAX_NUMBER_OF_FORMATS
  1924.     x = PyInt_FromLong(CL_MAX_NUMBER_OF_FORMATS);
  1925.     if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_FORMATS", x) < 0)
  1926.         return;
  1927.     Py_DECREF(x);
  1928. #endif
  1929. #ifdef CL_MAX_NUMBER_OF_ORIGINAL_FORMATS
  1930.     x = PyInt_FromLong(CL_MAX_NUMBER_OF_ORIGINAL_FORMATS);
  1931.     if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_ORIGINAL_FORMATS", x) < 0)
  1932.         return;
  1933.     Py_DECREF(x);
  1934. #endif
  1935. #ifdef CL_MAX_NUMBER_OF_PARAMS
  1936.     x = PyInt_FromLong(CL_MAX_NUMBER_OF_PARAMS);
  1937.     if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_PARAMS", x) < 0)
  1938.         return;
  1939.     Py_DECREF(x);
  1940. #endif
  1941. #ifdef CL_MAX_NUMBER_OF_VIDEO_ALGORITHMS
  1942.     x = PyInt_FromLong(CL_MAX_NUMBER_OF_VIDEO_ALGORITHMS);
  1943.     if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_VIDEO_ALGORITHMS", x) < 0)
  1944.         return;
  1945.     Py_DECREF(x);
  1946. #endif
  1947. #ifdef CL_MONO
  1948.     x = PyInt_FromLong(CL_MONO);
  1949.     if (x == NULL || PyDict_SetItemString(d, "MONO", x) < 0)
  1950.         return;
  1951.     Py_DECREF(x);
  1952. #endif
  1953. #ifdef CL_MPEG1_AUDIO_AWARE
  1954.     x = PyInt_FromLong(CL_MPEG1_AUDIO_AWARE);
  1955.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_AWARE", x) < 0)
  1956.         return;
  1957.     Py_DECREF(x);
  1958. #endif
  1959. #ifdef CL_MPEG1_AUDIO_LAYER
  1960.     x = PyInt_FromLong(CL_MPEG1_AUDIO_LAYER);
  1961.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_LAYER", x) < 0)
  1962.         return;
  1963.     Py_DECREF(x);
  1964. #endif
  1965. #ifdef CL_MPEG1_AUDIO_LAYER_I
  1966.     x = PyInt_FromLong(CL_MPEG1_AUDIO_LAYER_I);
  1967.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_LAYER_I", x) < 0)
  1968.         return;
  1969.     Py_DECREF(x);
  1970. #endif
  1971. #ifdef CL_MPEG1_AUDIO_LAYER_II
  1972.     x = PyInt_FromLong(CL_MPEG1_AUDIO_LAYER_II);
  1973.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_LAYER_II", x) < 0)
  1974.         return;
  1975.     Py_DECREF(x);
  1976. #endif
  1977. #ifdef CL_MPEG1_AUDIO_MODE
  1978.     x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE);
  1979.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE", x) < 0)
  1980.         return;
  1981.     Py_DECREF(x);
  1982. #endif
  1983. #ifdef CL_MPEG1_AUDIO_MODE_DUAL
  1984.     x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_DUAL);
  1985.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_DUAL", x) < 0)
  1986.         return;
  1987.     Py_DECREF(x);
  1988. #endif
  1989. #ifdef CL_MPEG1_AUDIO_MODE_JOINT
  1990.     x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_JOINT);
  1991.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_JOINT", x) < 0)
  1992.         return;
  1993.     Py_DECREF(x);
  1994. #endif
  1995. #ifdef CL_MPEG1_AUDIO_MODE_SINGLE
  1996.     x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_SINGLE);
  1997.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_SINGLE", x) < 0)
  1998.         return;
  1999.     Py_DECREF(x);
  2000. #endif
  2001. #ifdef CL_MPEG1_AUDIO_MODE_STEREO
  2002.     x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_STEREO);
  2003.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_STEREO", x) < 0)
  2004.         return;
  2005.     Py_DECREF(x);
  2006. #endif
  2007. #ifdef CL_MPEG1_AUDIO_SOFTWARE
  2008.     x = PyInt_FromLong(CL_MPEG1_AUDIO_SOFTWARE);
  2009.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_SOFTWARE", x) < 0)
  2010.         return;
  2011.     Py_DECREF(x);
  2012. #endif
  2013. #ifdef CL_MPEG1_END_OF_STREAM
  2014.     x = PyInt_FromLong(CL_MPEG1_END_OF_STREAM);
  2015.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_END_OF_STREAM", x) < 0)
  2016.         return;
  2017.     Py_DECREF(x);
  2018. #endif
  2019. #ifdef CL_MPEG1_ERROR
  2020.     x = PyInt_FromLong(CL_MPEG1_ERROR);
  2021.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_ERROR", x) < 0)
  2022.         return;
  2023.     Py_DECREF(x);
  2024. #endif
  2025. #ifdef CL_MPEG1_NUM_PARAMS
  2026.     x = PyInt_FromLong(CL_MPEG1_NUM_PARAMS);
  2027.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_NUM_PARAMS", x) < 0)
  2028.         return;
  2029.     Py_DECREF(x);
  2030. #endif
  2031. #ifdef CL_MPEG1_VIDEO_M
  2032.     x = PyInt_FromLong(CL_MPEG1_VIDEO_M);
  2033.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_M", x) < 0)
  2034.         return;
  2035.     Py_DECREF(x);
  2036. #endif
  2037. #ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_X
  2038.     x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_X);
  2039.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_X", x) < 0)
  2040.         return;
  2041.     Py_DECREF(x);
  2042. #endif
  2043. #ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_Y
  2044.     x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_Y);
  2045.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_Y", x) < 0)
  2046.         return;
  2047.     Py_DECREF(x);
  2048. #endif
  2049. #ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_X
  2050.     x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_X);
  2051.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_X", x) < 0)
  2052.         return;
  2053.     Py_DECREF(x);
  2054. #endif
  2055. #ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_Y
  2056.     x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_Y);
  2057.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_Y", x) < 0)
  2058.         return;
  2059.     Py_DECREF(x);
  2060. #endif
  2061. #ifdef CL_MPEG1_VIDEO_N
  2062.     x = PyInt_FromLong(CL_MPEG1_VIDEO_N);
  2063.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_N", x) < 0)
  2064.         return;
  2065.     Py_DECREF(x);
  2066. #endif
  2067. #ifdef CL_MPEG1_VIDEO_SOFTNESS
  2068.     x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS);
  2069.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS", x) < 0)
  2070.         return;
  2071.     Py_DECREF(x);
  2072. #endif
  2073. #ifdef CL_MPEG1_VIDEO_SOFTNESS_MAXIMUM
  2074.     x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS_MAXIMUM);
  2075.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS_MAXIMUM", x) < 0)
  2076.         return;
  2077.     Py_DECREF(x);
  2078. #endif
  2079. #ifdef CL_MPEG1_VIDEO_SOFTNESS_MEDIUM
  2080.     x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS_MEDIUM);
  2081.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS_MEDIUM", x) < 0)
  2082.         return;
  2083.     Py_DECREF(x);
  2084. #endif
  2085. #ifdef CL_MPEG1_VIDEO_SOFTNESS_NONE
  2086.     x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS_NONE);
  2087.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS_NONE", x) < 0)
  2088.         return;
  2089.     Py_DECREF(x);
  2090. #endif
  2091. #ifdef CL_MPEG1_VIDEO_SOFTWARE
  2092.     x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTWARE);
  2093.     if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTWARE", x) < 0)
  2094.         return;
  2095.     Py_DECREF(x);
  2096. #endif
  2097. #ifdef CL_MPEG_VIDEO
  2098.     x = PyInt_FromLong(CL_MPEG_VIDEO);
  2099.     if (x == NULL || PyDict_SetItemString(d, "MPEG_VIDEO", x) < 0)
  2100.         return;
  2101.     Py_DECREF(x);
  2102. #endif
  2103. #ifdef CL_MULTIRATE_AWARE
  2104.     x = PyInt_FromLong(CL_MULTIRATE_AWARE);
  2105.     if (x == NULL || PyDict_SetItemString(d, "MULTIRATE_AWARE", x) < 0)
  2106.         return;
  2107.     Py_DECREF(x);
  2108. #endif
  2109. #ifdef CL_MVC1
  2110.     x = PyInt_FromLong(CL_MVC1);
  2111.     if (x == NULL || PyDict_SetItemString(d, "MVC1", x) < 0)
  2112.         return;
  2113.     Py_DECREF(x);
  2114. #endif
  2115. #ifdef CL_MVC1_SOFTWARE
  2116.     x = PyInt_FromLong(CL_MVC1_SOFTWARE);
  2117.     if (x == NULL || PyDict_SetItemString(d, "MVC1_SOFTWARE", x) < 0)
  2118.         return;
  2119.     Py_DECREF(x);
  2120. #endif
  2121. #ifdef CL_MVC2
  2122.     x = PyInt_FromLong(CL_MVC2);
  2123.     if (x == NULL || PyDict_SetItemString(d, "MVC2", x) < 0)
  2124.         return;
  2125.     Py_DECREF(x);
  2126. #endif
  2127. #ifdef CL_MVC2_BLENDING
  2128.     x = PyInt_FromLong(CL_MVC2_BLENDING);
  2129.     if (x == NULL || PyDict_SetItemString(d, "MVC2_BLENDING", x) < 0)
  2130.         return;
  2131.     Py_DECREF(x);
  2132. #endif
  2133. #ifdef CL_MVC2_BLENDING_OFF
  2134.     x = PyInt_FromLong(CL_MVC2_BLENDING_OFF);
  2135.     if (x == NULL || PyDict_SetItemString(d, "MVC2_BLENDING_OFF", x) < 0)
  2136.         return;
  2137.     Py_DECREF(x);
  2138. #endif
  2139. #ifdef CL_MVC2_BLENDING_ON
  2140.     x = PyInt_FromLong(CL_MVC2_BLENDING_ON);
  2141.     if (x == NULL || PyDict_SetItemString(d, "MVC2_BLENDING_ON", x) < 0)
  2142.         return;
  2143.     Py_DECREF(x);
  2144. #endif
  2145. #ifdef CL_MVC2_CHROMA_THRESHOLD
  2146.     x = PyInt_FromLong(CL_MVC2_CHROMA_THRESHOLD);
  2147.     if (x == NULL || PyDict_SetItemString(d, "MVC2_CHROMA_THRESHOLD", x) < 0)
  2148.         return;
  2149.     Py_DECREF(x);
  2150. #endif
  2151. #ifdef CL_MVC2_EDGE_THRESHOLD
  2152.     x = PyInt_FromLong(CL_MVC2_EDGE_THRESHOLD);
  2153.     if (x == NULL || PyDict_SetItemString(d, "MVC2_EDGE_THRESHOLD", x) < 0)
  2154.         return;
  2155.     Py_DECREF(x);
  2156. #endif
  2157. #ifdef CL_MVC2_ERROR
  2158.     x = PyInt_FromLong(CL_MVC2_ERROR);
  2159.     if (x == NULL || PyDict_SetItemString(d, "MVC2_ERROR", x) < 0)
  2160.         return;
  2161.     Py_DECREF(x);
  2162. #endif
  2163. #ifdef CL_MVC2_LUMA_THRESHOLD
  2164.     x = PyInt_FromLong(CL_MVC2_LUMA_THRESHOLD);
  2165.     if (x == NULL || PyDict_SetItemString(d, "MVC2_LUMA_THRESHOLD", x) < 0)
  2166.         return;
  2167.     Py_DECREF(x);
  2168. #endif
  2169. #ifdef CL_MVC2_SOFTWARE
  2170.     x = PyInt_FromLong(CL_MVC2_SOFTWARE);
  2171.     if (x == NULL || PyDict_SetItemString(d, "MVC2_SOFTWARE", x) < 0)
  2172.         return;
  2173.     Py_DECREF(x);
  2174. #endif
  2175. #ifdef CL_MVC3_QUALITY_LEVEL
  2176.     x = PyInt_FromLong(CL_MVC3_QUALITY_LEVEL);
  2177.     if (x == NULL || PyDict_SetItemString(d, "MVC3_QUALITY_LEVEL", x) < 0)
  2178.         return;
  2179.     Py_DECREF(x);
  2180. #endif
  2181. #ifdef CL_MVC3_SOFTWARE
  2182.     x = PyInt_FromLong(CL_MVC3_SOFTWARE);
  2183.     if (x == NULL || PyDict_SetItemString(d, "MVC3_SOFTWARE", x) < 0)
  2184.         return;
  2185.     Py_DECREF(x);
  2186. #endif
  2187. #ifdef CL_NEXT_NOT_AVAILABLE
  2188.     x = PyInt_FromLong(CL_NEXT_NOT_AVAILABLE);
  2189.     if (x == NULL || PyDict_SetItemString(d, "NEXT_NOT_AVAILABLE", x) < 0)
  2190.         return;
  2191.     Py_DECREF(x);
  2192. #endif
  2193. #ifdef CL_NOISE_MARGIN
  2194.     x = PyInt_FromLong(CL_NOISE_MARGIN);
  2195.     if (x == NULL || PyDict_SetItemString(d, "NOISE_MARGIN", x) < 0)
  2196.         return;
  2197.     Py_DECREF(x);
  2198. #endif
  2199. #ifdef CL_NONE
  2200.     x = PyInt_FromLong(CL_NONE);
  2201.     if (x == NULL || PyDict_SetItemString(d, "NONE", x) < 0)
  2202.         return;
  2203.     Py_DECREF(x);
  2204. #endif
  2205. #ifdef CL_NUMBER_OF_FORMATS
  2206.     x = PyInt_FromLong(CL_NUMBER_OF_FORMATS);
  2207.     if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_FORMATS", x) < 0)
  2208.         return;
  2209.     Py_DECREF(x);
  2210. #endif
  2211. #ifdef CL_NUMBER_OF_FRAMES
  2212.     x = PyInt_FromLong(CL_NUMBER_OF_FRAMES);
  2213.     if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_FRAMES", x) < 0)
  2214.         return;
  2215.     Py_DECREF(x);
  2216. #endif
  2217. #ifdef CL_NUMBER_OF_PARAMS
  2218.     x = PyInt_FromLong(CL_NUMBER_OF_PARAMS);
  2219.     if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_PARAMS", x) < 0)
  2220.         return;
  2221.     Py_DECREF(x);
  2222. #endif
  2223. #ifdef CL_NUMBER_OF_PARAMS_FREEZE
  2224.     x = PyInt_FromLong(CL_NUMBER_OF_PARAMS_FREEZE);
  2225.     if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_PARAMS_FREEZE", x) < 0)
  2226.         return;
  2227.     Py_DECREF(x);
  2228. #endif
  2229. #ifdef CL_NUMBER_OF_VIDEO_FORMATS
  2230.     x = PyInt_FromLong(CL_NUMBER_OF_VIDEO_FORMATS);
  2231.     if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_VIDEO_FORMATS", x) < 0)
  2232.         return;
  2233.     Py_DECREF(x);
  2234. #endif
  2235. #ifdef CL_ORIENTATION
  2236.     x = PyInt_FromLong(CL_ORIENTATION);
  2237.     if (x == NULL || PyDict_SetItemString(d, "ORIENTATION", x) < 0)
  2238.         return;
  2239.     Py_DECREF(x);
  2240. #endif
  2241. #ifdef CL_ORIGINAL_FORMAT
  2242.     x = PyInt_FromLong(CL_ORIGINAL_FORMAT);
  2243.     if (x == NULL || PyDict_SetItemString(d, "ORIGINAL_FORMAT", x) < 0)
  2244.         return;
  2245.     Py_DECREF(x);
  2246. #endif
  2247. #ifdef CL_PARAM_OUT_OF_RANGE
  2248.     x = PyInt_FromLong(CL_PARAM_OUT_OF_RANGE);
  2249.     if (x == NULL || PyDict_SetItemString(d, "PARAM_OUT_OF_RANGE", x) < 0)
  2250.         return;
  2251.     Py_DECREF(x);
  2252. #endif
  2253. #ifdef CL_PIXEL_ASPECT
  2254.     x = PyInt_FromLong(CL_PIXEL_ASPECT);
  2255.     if (x == NULL || PyDict_SetItemString(d, "PIXEL_ASPECT", x) < 0)
  2256.         return;
  2257.     Py_DECREF(x);
  2258. #endif
  2259. #ifdef CL_PREDICTED
  2260.     x = PyInt_FromLong(CL_PREDICTED);
  2261.     if (x == NULL || PyDict_SetItemString(d, "PREDICTED", x) < 0)
  2262.         return;
  2263.     Py_DECREF(x);
  2264. #endif
  2265. #ifdef CL_PREROLL
  2266.     x = PyInt_FromLong(CL_PREROLL);
  2267.     if (x == NULL || PyDict_SetItemString(d, "PREROLL", x) < 0)
  2268.         return;
  2269.     Py_DECREF(x);
  2270. #endif
  2271. #ifdef CL_QUALITY_FACTOR
  2272.     x = PyInt_FromLong(CL_QUALITY_FACTOR);
  2273.     if (x == NULL || PyDict_SetItemString(d, "QUALITY_FACTOR", x) < 0)
  2274.         return;
  2275.     Py_DECREF(x);
  2276. #endif
  2277. #ifdef CL_QUALITY_LEVEL
  2278.     x = PyInt_FromLong(CL_QUALITY_LEVEL);
  2279.     if (x == NULL || PyDict_SetItemString(d, "QUALITY_LEVEL", x) < 0)
  2280.         return;
  2281.     Py_DECREF(x);
  2282. #endif
  2283. #ifdef CL_QUALITY_SPATIAL
  2284.     x = PyInt_FromLong(CL_QUALITY_SPATIAL);
  2285.     if (x == NULL || PyDict_SetItemString(d, "QUALITY_SPATIAL", x) < 0)
  2286.         return;
  2287.     Py_DECREF(x);
  2288. #endif
  2289. #ifdef CL_QUALITY_TEMPORAL
  2290.     x = PyInt_FromLong(CL_QUALITY_TEMPORAL);
  2291.     if (x == NULL || PyDict_SetItemString(d, "QUALITY_TEMPORAL", x) < 0)
  2292.         return;
  2293.     Py_DECREF(x);
  2294. #endif
  2295. #ifdef CL_QUANTIZATION_TABLES
  2296.     x = PyInt_FromLong(CL_QUANTIZATION_TABLES);
  2297.     if (x == NULL || PyDict_SetItemString(d, "QUANTIZATION_TABLES", x) < 0)
  2298.         return;
  2299.     Py_DECREF(x);
  2300. #endif
  2301. #ifdef CL_RANGE_VALUE
  2302.     x = PyInt_FromLong(CL_RANGE_VALUE);
  2303.     if (x == NULL || PyDict_SetItemString(d, "RANGE_VALUE", x) < 0)
  2304.         return;
  2305.     Py_DECREF(x);
  2306. #endif
  2307. #ifdef CL_RGB
  2308.     x = PyInt_FromLong(CL_RGB);
  2309.     if (x == NULL || PyDict_SetItemString(d, "RGB", x) < 0)
  2310.         return;
  2311.     Py_DECREF(x);
  2312. #endif
  2313. #ifdef CL_RGB332
  2314.     x = PyInt_FromLong(CL_RGB332);
  2315.     if (x == NULL || PyDict_SetItemString(d, "RGB332", x) < 0)
  2316.         return;
  2317.     Py_DECREF(x);
  2318. #endif
  2319. #ifdef CL_RGB8
  2320.     x = PyInt_FromLong(CL_RGB8);
  2321.     if (x == NULL || PyDict_SetItemString(d, "RGB8", x) < 0)
  2322.         return;
  2323.     Py_DECREF(x);
  2324. #endif
  2325. #ifdef CL_RGBA
  2326.     x = PyInt_FromLong(CL_RGBA);
  2327.     if (x == NULL || PyDict_SetItemString(d, "RGBA", x) < 0)
  2328.         return;
  2329.     Py_DECREF(x);
  2330. #endif
  2331. #ifdef CL_RGBX
  2332.     x = PyInt_FromLong(CL_RGBX);
  2333.     if (x == NULL || PyDict_SetItemString(d, "RGBX", x) < 0)
  2334.         return;
  2335.     Py_DECREF(x);
  2336. #endif
  2337. #ifdef CL_RLE
  2338.     x = PyInt_FromLong(CL_RLE);
  2339.     if (x == NULL || PyDict_SetItemString(d, "RLE", x) < 0)
  2340.         return;
  2341.     Py_DECREF(x);
  2342. #endif
  2343. #ifdef CL_RLE24
  2344.     x = PyInt_FromLong(CL_RLE24);
  2345.     if (x == NULL || PyDict_SetItemString(d, "RLE24", x) < 0)
  2346.         return;
  2347.     Py_DECREF(x);
  2348. #endif
  2349. #ifdef CL_RLE24_SOFTWARE
  2350.     x = PyInt_FromLong(CL_RLE24_SOFTWARE);
  2351.     if (x == NULL || PyDict_SetItemString(d, "RLE24_SOFTWARE", x) < 0)
  2352.         return;
  2353.     Py_DECREF(x);
  2354. #endif
  2355. #ifdef CL_RLE_SOFTWARE
  2356.     x = PyInt_FromLong(CL_RLE_SOFTWARE);
  2357.     if (x == NULL || PyDict_SetItemString(d, "RLE_SOFTWARE", x) < 0)
  2358.         return;
  2359.     Py_DECREF(x);
  2360. #endif
  2361. #ifdef CL_RTR
  2362.     x = PyInt_FromLong(CL_RTR);
  2363.     if (x == NULL || PyDict_SetItemString(d, "RTR", x) < 0)
  2364.         return;
  2365.     Py_DECREF(x);
  2366. #endif
  2367. #ifdef CL_RTR1
  2368.     x = PyInt_FromLong(CL_RTR1);
  2369.     if (x == NULL || PyDict_SetItemString(d, "RTR1", x) < 0)
  2370.         return;
  2371.     Py_DECREF(x);
  2372. #endif
  2373. #ifdef CL_RTR_QUALITY_LEVEL
  2374.     x = PyInt_FromLong(CL_RTR_QUALITY_LEVEL);
  2375.     if (x == NULL || PyDict_SetItemString(d, "RTR_QUALITY_LEVEL", x) < 0)
  2376.         return;
  2377.     Py_DECREF(x);
  2378. #endif
  2379. #ifdef CL_SAMPLES_PER_TILE
  2380.     x = PyInt_FromLong(CL_SAMPLES_PER_TILE);
  2381.     if (x == NULL || PyDict_SetItemString(d, "SAMPLES_PER_TILE", x) < 0)
  2382.         return;
  2383.     Py_DECREF(x);
  2384. #endif
  2385. #ifdef CL_SCHEME_BUSY
  2386.     x = PyInt_FromLong(CL_SCHEME_BUSY);
  2387.     if (x == NULL || PyDict_SetItemString(d, "SCHEME_BUSY", x) < 0)
  2388.         return;
  2389.     Py_DECREF(x);
  2390. #endif
  2391. #ifdef CL_SCHEME_NOT_AVAILABLE
  2392.     x = PyInt_FromLong(CL_SCHEME_NOT_AVAILABLE);
  2393.     if (x == NULL || PyDict_SetItemString(d, "SCHEME_NOT_AVAILABLE", x) < 0)
  2394.         return;
  2395.     Py_DECREF(x);
  2396. #endif
  2397. #ifdef CL_SPEED
  2398.     x = PyInt_FromLong(CL_SPEED);
  2399.     if (x == NULL || PyDict_SetItemString(d, "SPEED", x) < 0)
  2400.         return;
  2401.     Py_DECREF(x);
  2402. #endif
  2403. #ifdef CL_STEREO_INTERLEAVED
  2404.     x = PyInt_FromLong(CL_STEREO_INTERLEAVED);
  2405.     if (x == NULL || PyDict_SetItemString(d, "STEREO_INTERLEAVED", x) < 0)
  2406.         return;
  2407.     Py_DECREF(x);
  2408. #endif
  2409. #ifdef CL_STREAM_HEADERS
  2410.     x = PyInt_FromLong(CL_STREAM_HEADERS);
  2411.     if (x == NULL || PyDict_SetItemString(d, "STREAM_HEADERS", x) < 0)
  2412.         return;
  2413.     Py_DECREF(x);
  2414. #endif
  2415. #ifdef CL_TILE_THRESHOLD
  2416.     x = PyInt_FromLong(CL_TILE_THRESHOLD);
  2417.     if (x == NULL || PyDict_SetItemString(d, "TILE_THRESHOLD", x) < 0)
  2418.         return;
  2419.     Py_DECREF(x);
  2420. #endif
  2421. #ifdef CL_TOP_DOWN
  2422.     x = PyInt_FromLong(CL_TOP_DOWN);
  2423.     if (x == NULL || PyDict_SetItemString(d, "TOP_DOWN", x) < 0)
  2424.         return;
  2425.     Py_DECREF(x);
  2426. #endif
  2427. #ifdef CL_ULAW
  2428.     x = PyInt_FromLong(CL_ULAW);
  2429.     if (x == NULL || PyDict_SetItemString(d, "ULAW", x) < 0)
  2430.         return;
  2431.     Py_DECREF(x);
  2432. #endif
  2433. #ifdef CL_UNCOMPRESSED
  2434.     x = PyInt_FromLong(CL_UNCOMPRESSED);
  2435.     if (x == NULL || PyDict_SetItemString(d, "UNCOMPRESSED", x) < 0)
  2436.         return;
  2437.     Py_DECREF(x);
  2438. #endif
  2439. #ifdef CL_UNCOMPRESSED_AUDIO
  2440.     x = PyInt_FromLong(CL_UNCOMPRESSED_AUDIO);
  2441.     if (x == NULL || PyDict_SetItemString(d, "UNCOMPRESSED_AUDIO", x) < 0)
  2442.         return;
  2443.     Py_DECREF(x);
  2444. #endif
  2445. #ifdef CL_UNCOMPRESSED_VIDEO
  2446.     x = PyInt_FromLong(CL_UNCOMPRESSED_VIDEO);
  2447.     if (x == NULL || PyDict_SetItemString(d, "UNCOMPRESSED_VIDEO", x) < 0)
  2448.         return;
  2449.     Py_DECREF(x);
  2450. #endif
  2451. #ifdef CL_UNKNOWN_SCHEME
  2452.     x = PyInt_FromLong(CL_UNKNOWN_SCHEME);
  2453.     if (x == NULL || PyDict_SetItemString(d, "UNKNOWN_SCHEME", x) < 0)
  2454.         return;
  2455.     Py_DECREF(x);
  2456. #endif
  2457. #ifdef CL_VIDEO
  2458.     x = PyInt_FromLong(CL_VIDEO);
  2459.     if (x == NULL || PyDict_SetItemString(d, "VIDEO", x) < 0)
  2460.         return;
  2461.     Py_DECREF(x);
  2462. #endif
  2463. #ifdef CL_Y
  2464.     x = PyInt_FromLong(CL_Y);
  2465.     if (x == NULL || PyDict_SetItemString(d, "Y", x) < 0)
  2466.         return;
  2467.     Py_DECREF(x);
  2468. #endif
  2469. #ifdef CL_YCbCr
  2470.     x = PyInt_FromLong(CL_YCbCr);
  2471.     if (x == NULL || PyDict_SetItemString(d, "YCbCr", x) < 0)
  2472.         return;
  2473.     Py_DECREF(x);
  2474. #endif
  2475. #ifdef CL_YCbCr422
  2476.     x = PyInt_FromLong(CL_YCbCr422);
  2477.     if (x == NULL || PyDict_SetItemString(d, "YCbCr422", x) < 0)
  2478.         return;
  2479.     Py_DECREF(x);
  2480. #endif
  2481. #ifdef CL_YCbCr422DC
  2482.     x = PyInt_FromLong(CL_YCbCr422DC);
  2483.     if (x == NULL || PyDict_SetItemString(d, "YCbCr422DC", x) < 0)
  2484.         return;
  2485.     Py_DECREF(x);
  2486. #endif
  2487. #ifdef CL_YCbCr422HC
  2488.     x = PyInt_FromLong(CL_YCbCr422HC);
  2489.     if (x == NULL || PyDict_SetItemString(d, "YCbCr422HC", x) < 0)
  2490.         return;
  2491.     Py_DECREF(x);
  2492. #endif
  2493. #ifdef CL_YUV
  2494.     x = PyInt_FromLong(CL_YUV);
  2495.     if (x == NULL || PyDict_SetItemString(d, "YUV", x) < 0)
  2496.         return;
  2497.     Py_DECREF(x);
  2498. #endif
  2499. #ifdef CL_YUV422
  2500.     x = PyInt_FromLong(CL_YUV422);
  2501.     if (x == NULL || PyDict_SetItemString(d, "YUV422", x) < 0)
  2502.         return;
  2503.     Py_DECREF(x);
  2504. #endif
  2505. #ifdef CL_YUV422DC
  2506.     x = PyInt_FromLong(CL_YUV422DC);
  2507.     if (x == NULL || PyDict_SetItemString(d, "YUV422DC", x) < 0)
  2508.         return;
  2509.     Py_DECREF(x);
  2510. #endif
  2511. #ifdef CL_YUV422HC
  2512.     x = PyInt_FromLong(CL_YUV422HC);
  2513.     if (x == NULL || PyDict_SetItemString(d, "YUV422HC", x) < 0)
  2514.         return;
  2515.     Py_DECREF(x);
  2516. #endif
  2517. #ifdef AWCMP_STEREO
  2518.     x = PyInt_FromLong(AWCMP_STEREO);
  2519.     if (x == NULL || PyDict_SetItemString(d, "AWCMP_STEREO", x) < 0)
  2520.         return;
  2521.     Py_DECREF(x);
  2522. #endif
  2523. #ifdef AWCMP_JOINT_STEREO
  2524.     x = PyInt_FromLong(AWCMP_JOINT_STEREO);
  2525.     if (x == NULL || PyDict_SetItemString(d, "AWCMP_JOINT_STEREO", x) < 0)
  2526.         return;
  2527.     Py_DECREF(x);
  2528. #endif
  2529. #ifdef AWCMP_INDEPENDENT
  2530.     x = PyInt_FromLong(AWCMP_INDEPENDENT);
  2531.     if (x == NULL || PyDict_SetItemString(d, "AWCMP_INDEPENDENT", x) < 0)
  2532.         return;
  2533.     Py_DECREF(x);
  2534. #endif
  2535. #ifdef AWCMP_FIXED_RATE
  2536.     x = PyInt_FromLong(AWCMP_FIXED_RATE);
  2537.     if (x == NULL || PyDict_SetItemString(d, "AWCMP_FIXED_RATE", x) < 0)
  2538.         return;
  2539.     Py_DECREF(x);
  2540. #endif
  2541. #ifdef AWCMP_CONST_QUAL
  2542.     x = PyInt_FromLong(AWCMP_CONST_QUAL);
  2543.     if (x == NULL || PyDict_SetItemString(d, "AWCMP_CONST_QUAL", x) < 0)
  2544.         return;
  2545.     Py_DECREF(x);
  2546. #endif
  2547. #ifdef AWCMP_LOSSLESS
  2548.     x = PyInt_FromLong(AWCMP_LOSSLESS);
  2549.     if (x == NULL || PyDict_SetItemString(d, "AWCMP_LOSSLESS", x) < 0)
  2550.         return;
  2551.     Py_DECREF(x);
  2552. #endif
  2553. #ifdef AWCMP_MPEG_LAYER_I
  2554.     x = PyInt_FromLong(AWCMP_MPEG_LAYER_I);
  2555.     if (x == NULL || PyDict_SetItemString(d, "AWCMP_MPEG_LAYER_I", x) < 0)
  2556.         return;
  2557.     Py_DECREF(x);
  2558. #endif
  2559. #ifdef AWCMP_MPEG_LAYER_II
  2560.     x = PyInt_FromLong(AWCMP_MPEG_LAYER_II);
  2561.     if (x == NULL || PyDict_SetItemString(d, "AWCMP_MPEG_LAYER_II", x) < 0)
  2562.         return;
  2563.     Py_DECREF(x);
  2564. #endif
  2565.  
  2566.     (void) clSetErrorHandler(cl_ErrorHandler);
  2567. }
  2568.